Background
Sometime back I had written a post about git (it's installation and usage in windows). This post simple covers it's Linux counterpart. How to install git in Ubuntu.
Installing git on Ubuntu
To install git execute following command -
- git apt-get install git-core
Post installation you can run following command to verify installation -
- git --version
And you are all good to go!
To set up git config you can use following command -
- git config --global user.name "aniket91"
- git config --global user.email "you@example.com"
- git config --list
- cat ~/.gitconfig
Try cloning a repository
- git clone https://github.com/aniket91/DataStructures.git
My Git Repositories
Avoid Merge Commits
Whenever you have unpushed commits on your local and you try to do a git pull after those commits it will create a merge commit .To avoid it follow one of the below mentioned methods,
- run git pull --rebase
- To avoid running it with the rebase flag and to make the above the default behavior when pulling changes, git config --global branch.autosetuprebase always
- In SourceTree under tools->options/preferences under the Git tab select "Use rebase instead of merge by default for tracked branches"