Saturday, December 12, 2015

IT (6): git.......


CVS: Concurrent Versions System
Git is more flexible, reliable than other version control system, though it is more complex as well.
Use of git:
Revision control is needed to modify code and sync, so that labmates can use the latest one. Its less clumsy than mailing or something like that.

Configuration management to easily diagnose and fix bugs

Revision history enables reverting back. It should be clean and followable.
Public branch: Commit message to inform others of the revision done.
Private branch: Push for self-work, mutable
Create a branch off Master
Work
Merge the corrected branch to Master


Working directory to repository: add, commit, delete
Repository to working directory : checkout, update, revert
Bilateral: diff, status, log

After..reset, rebase...........when its clean enough private and public branch should be merged.
-----------------------------------
git add: Saving changes before committing
git branch: Creating another version in the same repository
git checkout: Leaving old commits and navigating among existing branches
git clean: Removing untracked files from an working directory
git clone: Making an copy of existing git repository
git commit: After changes are made, they are shown in history
git commit --amend: The latest commit can be amended
git config: Configuring git as per requirement (needed only one, just after installing Git)
git fetch: It downloads a branch and its related files from a repository
git init:Used to put a project under a repository
git log: Enables visiting revision history
git merge: Opposite of branching as it merges different branches
git pull: Downloads a branch from a remote repository and merges with current branch
git push: Sends a branch to another repository (opposite of fetch)
git rebase: Allows  minimizing merge commits
gite rebase -i: rebasing in interactive mode
git reflog: Keeping track of updates
git remote: For shortcut-based remote connection
git reset: Operating only on tracked files; allows removal of changes that has been pushed to public branch
git revert: It nullifies a commit command
git status: Shows present state of the working directory

*Above 20 git commands to manipulate project and its revision control
*Fetch and pull are similar..
*Opposite of fetch is push
*Opposite of branch is merge
-----------------------------------
In order of use: git init, git clone, git config, 

#Project started at central repository
ssh <user>@<host>
cd  repository
git init --bare my_project.git

#Project copied from central repository to local machine
git clone <repository> <directory>
git clone ssh://Seema@example.com  my_project.git
cd my_project

# Git configuration
git config --global user.name "Seema"
git config --global user.email <email_id>
---------------------
git checkout -b private_banc
touch file
git add file
git commit 

No comments:

Post a Comment