Common git command record

Daily Development Series

  1. git status : Check local changes
  2. git pull --rebase : Pulling the distal end of the code and combined
  3. git add . : Scratch all local codes updated
  4. git add -p: On-demand staging local update the code, if need be submitted to follow the prompts for ynot submitting input n, automatically enter the next
  5. git push : Submit native code
  6. git checkout -b +分支名 : New git branch, and switch to the new branch
  7. git checkout +分支名 : Switching to the branch
  8. git stash save : Will not scratch code isolation
  9. git stash pop : Restore the isolation of code to local
  10. git log: View Submission History
  11. git diff +分支名: Comparison with other branches of the current branch code
  12. git cherry-pick + 需要合并到当前分支的其他分支的commitId
  13. git commit --amend : Information on the changes once commit or commit the information to be used once this commit
  14. git branch -v : View the current branch
  15. git reset --hard + 回退到不需要的代码的上一次commitId : After back to back, after commitId (chronologically) code is missing, the local is not retained.

git remote series

: Reference github- manage remote warehouse
submission address 1. Add the local project code

git remote add <remote name, usually origin> <LOCATION>

Examples: git remote add origin [email protected]/lb01-bsdd-vm.git

2. Delete the remote address

git remote rm <distal name>

Examples: Origin RM Remote Git
2. Submit the remote address setting

git remote set-url --push origin <LOCATION>

3. Review the settings distal submitted

git remote -v

4. merge, change a few commit records recently submitted

2 ~ -i the HEAD rebase the Git (commit number is included in, a variable quantity)
Git commit --amend (Change last commit record)

Operation: git commit --amend, press ithe enter edit mode, editing is complete, shift+:enter wqto save and exit.

git config configuration Series:

Check local git configuration:

git config --list

Set code repository user name

git config --global user.name Username

Set code repository user's mailbox

git config --global user.email user's mailbox

View the source Download

View Download Source:

yarn config get register

Set the download source:

yarn config set register source address

Initialize the project and submit

  1. git init
  2. git add when change
  3. git commit -m 'project initialization'
  4. Add distal project addresses submitted git remote add origin [ssh Address]
  5. git remote -v: view the added address is successful, and push the fetch address contains the instructions to add success
  6. git push --set-upstream origin master
  7. If the previous step reported the following error:
    Here Insert Picture Description
    enter ssh-keygen -t rsa -C [git a global user name], the user name can be viewed by git config -l.
  8. Enter ssh-keygen -t rsa -C three input options will appear one [global user name git's] post, simply press the Enter key to the next step, when the task is executed, the console input address suffix pub file, find pub file suffix, under the SSH public key code or github account in the cloud, the new public key will be to find the contents of the file copied to the new pub public key to generate a new public key.
  9. git push --set-upstream origin master project can submit code to a remote address.
Published 18 original articles · won praise 10 · views 625

Guess you like

Origin blog.csdn.net/llq886/article/details/103457867
Recommended