Git Commands

If you have just started using git (version control software) and want to use some basic git commands to get going, you can go through the below-given commands. I have compiled a simple list of commands that are used very often.

Git Commands
How to get Username?
uname -a
How to get git version?
git --version
How do I force “git pull” to overwrite local files?
git reset --hard HEAD
git pull
How to fetch latest code from git?
git fetch
How to get latest code from integration?
git checkout integration
git pull
How to checkout particular commit?
git checkout c5b60316f41
How to create branch?
git checkout -b feature/MyBranch
or
git checkout -b bugfix/MyBranch
How to push changes in branch?
git push -u origin feature/MyBranch

A collection of useful .gitignore templates

https://github.com/github/gitignore

Leave a comment

Your email address will not be published. Required fields are marked *