Sunday, September 6, 2015

Git Repository

If you are using Github, creating a Git repository means that creating a space in the Github site for storing the files.

If you are using Git locally, creating a Git repository means enabling the features of Git, such as version control.


Creating Git repository is done for a given directory.  It can be a new or an existing directory.

Once you create a repository, the Git features can be enabled.

You can create a Git repository for a directory by

1. Switch to that directory
2. Run this command

git init

After you run the above command, nothing really happens immediately.

You can start to add the files under the directory to the repository.

For any changes that you are sure and would like to be tracked by Git, you commit the changes to Git.  Those changes will not be lost.

You can view the historical version of the file by specifying the version, using the show command.

git show HEAD~1:README.txt

The above command can show the initial version of the README.txt file.




Post a Comment