Git - Command reference
This post centralizes usefull git commands.
Setting up your Git environment
Let Git know you you are.
git config --global user.name "Patrice LACHANCE"
git config --global user.email patlachance <at> gmail <dot> com
echo export LESS=-R >> ~/.bashrc
If you don’t specify the ‘–global’ parameter, this will apply only to this single checked-out directory. Save the export command in your shell environment’s configuration file.
Looking at the changes you made
Run ‘git diff’ to see which files where modified or added to the tree. You can focus on specific files.
git diff [files]
Commiting your change in your local repository
Commiting the files will create a new checkpoint in the Git repository.
git commit [files]
Generate the patch file
git format-patch HEAD^
An editor will fire up. Enter a quick description of your changes, save and quit (:wq). Now send the resulting file to the maintainer of the code to share with the commmunity!
Resynchronizing with upstream branch
You might need for some reasons to resynchronize your local branch with the upstream one. Be careful, the following commands will wipe all changes you made in your local branch.
git fetch origin master
git reset --hard FETCH_HEAD
git clean -dfx
blog comments powered by Disqus