Work commonly used operating Git

Paste from: micro-channel public number: Programmer's total growth

Branch operation:

  1. git branch create a branch
  2. git branch -b create and switch to the new branch
  3. git checkout branch switching
  4. git branch to view the list of branches
  5. git branch -v View all branches of the last operation
  6. View current branch git branch -vv
  7. git brabch -b branch name origin / branch name to create a remote branch local
  8. git branch --merged view branch and other branches merge through a branch current
  9. git branch --no-merged branch and did not see the current branch merge
  10. git branch -d branch delete local branch name
  11. git branch -D branch branches were forcibly removed
  12. git branch origin: delete the name of a branch branch distant warehouse
  13. git merge branch name branch to merge the current branch

Staging the:

  1. git stash modify the current staging
  2. git stash apply to restore the most recent staging
  3. git stash pop to recover and remove the temporary staging record
  4. git stash list to view the list of staging
  5. git stash drop temporary name (Example: stash @ {0}) to remove a temporary times
  6. git stash clear Clear scratch

Fallback action:

  1. git reset --hard HEAD ^ fall back to the previous version
  2. git reset --hard ahdhs1 (commit_id) fall back to a version
  3. git checkout - file undo modified file (if the file is added to the staging area, then fall back to the staging area, if the file is added to the repository, then revert to the state after the addition of the repository)
  4. git reset HEAD file to withdraw the temporary area to the workspace file modification

Label operation:

  1. Add git tag tag name tag (the default for the current version)
  2. git tag tag name commit_id submit a record of playing tag
  3. git tag -a label name -m 'Description' to create a new label and increased Remarks
  4. git tag lists all the tags list
  5. git show label name to view label information
  6. git tag -d delete the local name tag label
  7. git push origin label name tag pushing to a remote repository
  8. git push origin --tags push all the tags to a remote repository
  9. git push origin: refs / tags / tag name to delete the label from a remote repository

General operation:

  1. git push origin test to a remote repository to push local branch
  2. git rm -r --cached file / folder name of the file to be canceled version control
  3. git reflog get executed commands
  4. git log --graph looking at branches merged graph
  5. git merge --no-ff -m 'Merge Description "Fast forward branch name does not use merge mode, combined in this way can be seen to merge records
  6. git check-ignore -v filename View ignore rules
  7. git add -f to force the submission file name

Create a project git repository:

  1. git init initialization
  2. git remote add origin url associated with the remote warehouse
  3. git pull
  4. remote repository git fetch get to all of the local branch

Ignore added to the file repository:

  1. git update-index --assume-unchanged file ignore a single file
  2. git rm -r --cached file / folder name (Ignore all files)

Cancel Ignore file:

  1. git update-index --no-assume-unchanged file

Pull, upload password-free:

  1. git config --global credential.helper stor

Guess you like

Origin www.cnblogs.com/youpeng/p/10954756.html