git basic articles to hand a note
【command】
$ Git init --- initialization (.git directory created in the current directory, while the current directory into a Git repository)
$ Git status --- see the current status / see what changes
$ Git add. --- add new files and need to be submitted and tracked changes
$ Git commit -m 'remarks submitted (reMark)' --- the staging area where the changes to be submitted to the local repository
$ Git pull origin master (branch name) --- pulled under the code branches to the current branch and merge
$ Git push origin master --- local master branch to push origin master
$ Git remote show origin --- view the current warehouse address
$ Git remote add origin Git address --- Add a remote repository folder for the current file
$ Git remote set-url origin Git address --- set a new warehouse address
$ Git log --- View submission history
$ Git reflog --- see the version number and submit
$ Git reset --hard head (version number) --- fallback version of the code specified
【conflict】
Generally when pulling down the code from the remote host native code (execution pull operation) will merge conflict, performance:
《《《《《《 head ============== =|=|=|=|=|=|=|=|=
solve:
- After git pull origin master execution,
- View the status of git status, red for the conflict files,
- After modifying the file, re-git add commit push
For pulling combined understood:
git pull = fetch (pull) + merge (merging); Bottom:
Gangster draw comments:
Remember, the pull is acquired and merged.
-
git pull origin master branch acquired from origin to submit remotely master (enter local origin / master branch), then the origin / master merge into your currently checked out branch.
-
git pull only when you check out of the branch is tracking upstream branch when working. For example, if you check out the original branch trace / Master,
git pull
it is equivalent togit pull origin master