Bloggers recently learning git command, because git is a very easy to use version management tools, powerful features than svn support local warehouse store, like many large companies are now done with the git version control.
Initialize a local repository, there will be a hidden file in the same directory .git
git init
Check the configuration of git
git config -l
Configuring userName local git repository (must)
git config user.name 'Lee'
Configuring local repository git-mail (required)
git config user.email '[email protected]'
Three configuration file path:
.git / config /.gitconfig # Current user directory / etc / gitconfig #git installation directory
Local submit to the git index (cache)
git add. # to add a new, modified, are added to the cache git add -A # to add, and modify, and delete are added to the cache
Local library to the file from the cache (repository) in
git commit -m 'version of the description' # submit documents to the library
A document submitted to the local library
git commit -am 'version of the description' # submit one step
Git view the current status information (documents to see if there are uncommitted)
git status
Three types of files in git
Tracked (tracked): has joined the document library are not tracked (untracked): no added document libraries ignored (ignored): Ignore files that do not require management of a folder or file
Under the new git ignore file directory to create a .gitignore file (can have more influence scope of the current files and subfolders)
touch .gitignore
.gitignore ignore the contents of the file demo
# Maven # target/ # IDEA # .idea/ *.iml # Eclipse # .settings/ .classpath .project
Note: a new file is ignored, why not take effect
A: Probably because you already have files in the cache ignored, so you need to clear the cache in the file, and commit to re-add operation
Delete all files in the command buffer
git rm -r --cached. # The main point must write
To re-add buffer
git add .
Each commit is a commit point, a unique identification of SHA1 ID, ID may be used before numerals 4-7
View git log information
git log
Submit to the point of playing tag git tag -a v0.2 4a80f64 (ID before submitting seven points of SHA1)
Tag -a tagV1 d819565b git # commit point SHA1 of ID before 7
Enter the tag will be content after a carriage return interface, then click the same as linux i edited and then enter information esc: wq save and exit
Simplified format log output git
git log --oneline
Display branches from the main branch and git log (front will more asterisks)
git log --oneline --graph