FreeKB - Version control in Git - Getting Started
Version control in Git - Getting Started

Home > Search


Git is a version control system, where different versions of a file will be stored. First and foremost, you have to install Git on the server that will be using Git.


pull / add / commit / push

The general flow of working with files in Git is to first do a pull, which pull down the latest revision of each file in the master Git repository (trunk) to your local Git repository (branch), so that you are working with the latest revision of each file. Then, you can add a new file to your local Git repository (branch), or update an existing file in your local Git repository (branch). Once you are satisfied with the file, you will commit the file in your local Git repository (branch), which creates a new revision of the file. Finally, you will push the file from your local Git repository (branch) to the master Git repository (trunk).

 


status / log / show / differences

When first learning Git, or when debugging some issue with a file, you'll almost always want to use the git status command to view the status of the file and the git log command to list what was done to the file at each commit.

The git show command can be used to view the content of a file at a certain commit.

You may also want to list the differences between the file at certain revisions.

 


Roll back to a prior revision

Rolling back to a prior version of a file is fairly easy. You first use the git log command to get the commit ID that you want to roll back to and then use the git reset command so that your working copy is the prior version.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 7480a in the box below so that we can be sure you are a human.




Comments