Create a local repository git init demo Create a demo folder as a repository if it's an older version(before 1.6.5), do not support this writing, need to go to the Demo folder, and then execute the GIT init command,The current folder will be created as a repository and the repository will create a.git hidden file checkout project git clone down a repository from the server example: Git clone https:Github.com/nbcoolkid/spring.git if it's a local repository git clone.. /gitserver/demo demo-step-1 Description:d Emo is the workspace directory for the repository,Demo-step-1 is the directory after Clone View project git Status View current local file in repository state git log View commit log git diff compare file modified after difference git--version view current git version git rev-parse--git-dirShow Repository.git directory git rev-parse--show-toplevel show workspace root directory for git, is not differentiated between the working directory and the repository directory.git reflog View recent actions added/delete files into git version control git add filename add new files to the repository git add-u put all the modified files into the staging git add-a will be deleted locally with the new Add-ins to staging area git rm filename adds deleted files to repository git rm--cached filename Ignore file, and it needs to be configured to.Gitignore file commits the update git commit will be added to the repository file to commit git commit-m"Submission Instructions" If you do not use the-m parameter to submit a description,There will also be a hint for us to enter submit information submitted to the server Git push commits the local modification to the remote repository by prompting for a user name password conflict to be generated: After two users clone a copy of the code from the repository, a user commits the Post-B users also commit, and they modify the same file, creating a conflict. Because Git does not know whether this file should use a or B to solve the idea: B before committing, merge the commit of a, and then submit to the server git pull merge conflict auto merge may fail, we need to receive open file for Modify update git add fileName git commit-m"Message"git push environment variable git config core.Quotepath False to set environment variables,solve the problem of displaying garbled characters in these git command output in the Chinese file name sudo git config--system alias.The ST status sets a simple alias for the git command, after the above settings,git st is equivalent to git status all users are effective sudo git config--system alias.commit ci git config-global alias.The St status function is the same as the previous one, only the global properties of this user are configured.Which is only valid for the current user git config--global color.UI True to turn on the color display in the git command output git config-e edit the configuration information for the current repository equivalent to editing. git/config file git config-e--global Edit Current user Global profile equivalent to edit ~/.gitconfig git config-e--system Edit system global profile equivalent to edit/etc/Gitconfig back in the past git reset--hard Commitid Here's hard is a commit pointer to the repository back in the future when using git reset--hard back to a version, if you want to return to the original version, first After using the git reflog command to see Commitid, or using git reset--hard commitid back to the next milestone concept: A version number of the software to create a milestone: in GitHub, open the project, point Click Releases, follow the prompts to fill in the milestone information completed, submitted, will release this version. Branch Branch Development: Graphics Operations on Windows: Click on the inverted triangle to the right of master to create a branch triangle->manage-> PlusEnter a branch name, switch to a new branch, and then modify the submitted branch merge on the new branch: Graphics operations on Windows: Into the Versioning Branch window (Triangle->manage-> PlusEnter a branch name) move the branch to the left of the merge, the trunk branch to the right of the merge, and click Merge Another way of merging the branches: on GitHub, if a branch is made locally and the update is submitted, the GitHub site , it reminds us if we want to merge the branches. Common open source software uses this approach to merge branching
Basic use of Git