In the Software Development world version control plays an very important role in securing you project source code by mentaining a proper version of your project, As said Git commands are the backbone through which one can manage and track changes in software development projects and each developer is given a git branch when he and upload and keep backup of his code and maintain version.
In this git article, let’s dive into the all the essential GIT commands that every software developer should know, that empower developer to easily manage version control.
Git Commands
git init
This git command is basically used to start a new git repository. it will create a .git file in project directory.
git init [repository name]
git clone
This git command is used to clone or download a repository from an existing gitHub repo.
git clone [repository URL]
git add [file name]
This git command is used to stage or add a file what will be pushed into github repo using git push cmd.
git add [file name]
git add .
This git command is used to add all file what will be pushed into github repo using git push cmd.
git add .
git commit – m
This git command takes a snapshot of project’s currently staged changes.
git commit -m “[ meaningful message]”
git diff
This command shows the file differences which are not yet staged.
git diff
git diff -staged
This command shows the differences between files in the staging area and latest version present.
git diff -staged
git status
This command shows all the modified files which are not committed.
git status
git log
This command shows the list of version history.
git log
git branch
This command shows all the branches of repo.
git branch
git checkout
This command is used to switch between branches.
git checkout [branch name]
To create new branch and switch to that.
git checkout -b [branch name]
git push
This command sends all committed changes to your repo.
git push origin master
git merge
This command shows all the branches of repo.
git merge [branch name]
git pull
This command fetch and merge changes.
git pull [Repository Link]
git stash
This command temporarily stores all the modified tracked files.
git stash save