Why you should learn Git
On this page
Git #
Git is a great version control system, which makes it easy to manage different versions of your programming project. I use git not only for my programming projects, but also for publishing Website Blog Posts like this. Instead of getting access to your server and upload your files, which can be very annoying, a git push will do the magic.
Commands #
Here are some really useful git commands for daily use.
Simple standard workflow:
git pull
git add <some file>
git commit -m 'comment'
git push
Show commits and changes #
git show
Show remote config of git repository #
git remote -v
Remove last pushed commit #
uncommit last commit
git reset --soft HEAD^
git push origin +master
Git Configurations #
View your system, global and local configuration. Git configuration variables can be stored at three different levels. Each level overrides values at the previous level.
You can specify your scope with the parameters --system
, --global
, --local
.
git config --list
Example, set global user.name
git config --global user.name xyz
Change your url endpoint origin
git remote set-url origin git@github.com
Let git save your credentials. Can be useful if you are accessing the Repository via https and don’t want to enter your password every time.
git config --global credential.helper store
References #
For more look into the official documentation of git: