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

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.

clone / pull

The general flow of working with files in Git is to first clone a repository to your local PC, which creates a working copy of each file in the master Git repository (trunk) to your local Git repository (branch). After you've cloned, you can also do a pull, which pull down the latest revision of one or more files from the master Git repository (trunk) to your local Git repository (branch), so that you are working with the latest revision of each file.


add / commit / push

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 6bddb in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |