Version control (sometimes referred to as source control) plays an important role in any development project, including test automation. It is the practice of tracking and providing control over changes made in the source code. And since one of the most common tools used in version control is Git, let’s get to understand some of the most common Git commands.
Git is a fast, scalable, and distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.
Initialize current directory as a Git repository.
gitinit
Create a local copy of a repository from a hosted location via URL.
gitcloneURL
Show a list of modified files in your working directory and whether they are staged for the next commit.
gitstatus
Add changes from a specific file to the stage, ready for your next commit.
gitaddfile.js
Add changes from all files to the stage ready for your next commit.
gitadd.
Unstage a specific file, while still retaining the changes in the working directory.
gitresetfile.js
Unstage all files, while still retaining the changes in the working directory.
gitreset
Display a list of branches with an asterisk(*) next to the active branch
gitbranch
Create a new branch
gitbranchname
Switch to another branch and check it out into your working directory.
gitcheckoutbranch
Create a new branch and switch to that branch
gitcheckout-bbranch_name
Commit your staged content as a new commit snapshot with a specified message.
gitcommit-m"your commit message"
Fetch all the changes from the remote repository and merge any remote changes in the current local branch.
gitpull
These are few basic commands which can help you get started with git easily. Hope you find this article useful.
I have a nice addition for that. I recently experienced with Git Aliases and have to say that they are really awesome and should be know by every Git user!
Because I like them so much I created an article that explain how I use them to delete all my local branches that I do not need anymore:
educating about proxies - a technology enabling public data collection in large volumes, providing businesses with valuable insights into markets and their competitors
Top comments (5)
This is a nice list on the basic Git commands.
I have a nice addition for that. I recently experienced with Git Aliases and have to say that they are really awesome and should be know by every Git user!
Because I like them so much I created an article that explain how I use them to delete all my local branches that I do not need anymore:
If you are interested you can read about it here: knulst.de/how-to-remove-local-git-...
If you did not know about Git Alias it's worth reading about!
Thanks for sharing, and making this article useful for every reader.
It already was super useful!!
I am just so happy about Git Alias and want to spread the information :-D. I'm totally into them since 1 week ^^
Thanks for sharing great info
Thanks for compiling this list