Git(to be continued...)
You tell Git you want to save a snapshot of your project with the git commit
command and it basically records a manifest of what all of the files in your project look like at that point. Then most of the commands work with those manifests to see how they differ or pull content out of them.If you think about Git as a tool for storing and comparing and merging snapshots of your project, it may be easier to understand what is going on and how to do things properly.
1、Getting and creating project.
In order to do anything in Git, you have to have a Git repository. This is where Git stores the data for the snapshots you are saving.There are two main ways to get a Git repository(initialize a new one from an existing directory or clone one from a public Git repository).
1)、git init
To create a repository from an existing directory of files, you can simply run git init
in that directory.You can do this in any directory at any time, completely locally.
#git init
Now you can see that there is a .git
subdirectory in your project. This is your Git repository where all the data of your project snapshots are stored.
2)、git clone
You simply run the git clone [url]
command with the URL of the project you want to copy.
#git clone /home/jay/applications/
This will copy the entire history of that project so you have it locally and it will give you a working directory of the main branch of that project so you can look at the code or start editing it. Also, you can see the .git
subdirectory - that is where all the project data is.
2、Base snapshotting.
to be continued...
3、Reference.
Git Reference: http://gitref.org/inspect/#log