Practical Git Commands
In this post, we will discuss some practical Git Commands. These are frequently used commands while working with automation using Git. Git is a distributed version source control system.
To initialize a Git repository, type the following command:
/> git init
/> git status
To know the project status. It’s healthy to run git status often. Sometimes things change and you don’t notice it.
When we add a new file, we will notice that Git says it is “untracked”. Git sees that as a new file. To tell Git to start tracking changes made to sample.txt, we need to first add it to the staging area by using git add.
/> git add sample.txt
Files are ready to be committed.
Files with changes that have not been prepared to be committed.
Files aren’t tracked by Git yet. This usually indicates a newly created file.
To tell Git to start tracking changes made to a file , we first need to add it to the staging area by using git add.
git add sampleFile.txt
You can use git reset <filename> to remove a file or files from the staging area.
Use git log –summary to see more information for each commit. You can see where new files were added for the first time or where files were deleted. It’s a good overview of commits.
The push command tells Git where to put our commits when we’re ready. The -u tells Git to remember the parameters( like remote and local branch names ) , so that next time we can simply run git push and Git will know what to do.
Sometimes when you go to pull you may have changes you don’t want to commit just yet. One option you have, other than committing, is to stash the changes. Use the command ‘git stash’ to stash your changes, and ‘git stash apply’ to re-apply your changes after your pull.
Git Tutorial on this website can be found at:
For more details on the Git, visit the official website at: