These are most of the commands used in git.
Name and Email address
git config –-global user.name ‘UserName’
git config –-global user.email ‘User-email’
UserName : mention your username
User-email :mention your email
How to sync your work with the repository
git status
git add .
git commit –m’your description of change’
git pull –-rebase
git push
git status
How to create or recreate your local repository
git clone //servername/html$/eFormRepo .
git config push.default tracking
How to determine what has changed
git status
git diff
git diff –-stat
git log
git log --name-only --since='12/10/2009 10:41' --pretty=oneline
git log --name-only --since='12/10/2009 10:41' --
pretty=oneline>filename.txt
git gui blame cgi-bin/SoapConnect.cgi
How to get help
git help
How to remove a file or directory
git rm filename
git rm directory –r
How to move a file or directory
git mv source_filename destination_filename
git mv source_directory destination_directory
git mv source_filename destination_filename –n (dry run)
How to handle a merge conflict
During a git pull -–rebase you encounter merge conflict.
The file
that has a merge conflict will be displayed in the error.
Open file that has a merge conflict and find the text that is in
conflict.
Git will present both sides of the conflict and it is up
to you to determine what the file should look like.
have information similar to this.
The file will
git add filename (this is the name of the conflicted file)
git rebase –-continue
Working with Branches
git push origin origin:refs/heads/vendor_interface_tracking (create
branch)
git fetch origin (bring changes)
git branch –r (display remote branches)
git checkout -–track –b vendor_interface_tracking
origin/vendor_interface_tracking (one time only per branch)
git checkout vendor_interface_tracking (work on branch)
git checkout master (back to master)
git push origin :heads/vendor_interface_tracking (remove branch)
Creating a bare repository
git –-bare init










0 comments: