Get the App
SLTechnology News&Howtos  ›  Servers  › 

Git common commands

Shulou Source: shulou.com Published: 2022-06-03 04:44:59 10月22日 Update

Git's command

1.git status: check git to see if there are any changes to be submitted

2.git diff file name: what has been modified in the current file compared to the remote end

3.git add file name: point to the content file to be submitted

4.git commit-m "comments" submission file name: submit to local library

5.git pull-rebase: pull the remote code

6.git push: submit to remote warehouse

7.git log

8. There are local changes, want to update the remote data and then their own code on the pull. (git status- > git stash- > git stash list- > git pull-- rebase- > git stash pop (restore)

9. There are two submit commands, git push origin master (normal commit) and git push origin master-f (forced commit, which may put the previous commit comment information, will not change the modified code, and should be used with caution), both of which are submitted to the master branch

10.git rm-- cached file name: changed from Changes to be committed status to "Untracked files" file status

11.git config-- list: view git configuration

12.git config usr.name: check the name of the git configuration. You can add the user name directly after the setting.

13.git config usr.email: check the mailbox configured by git. You can add the mailbox name directly after the setting.

14.git checkout-b dev origin/dev, which acts as a remote dev branch of checkout, calls it the dev branch locally, and switches to the local dev branch

15.rebase

1. Update master

(1) git checkout master

(2) git pull origin master

2.merge master

(3) git checkout yourbranch

(4) git merge master

3.push to the far end

(5) git push origin local branch name: remote branch name

16. Delete remote branch: git push origin-- delete branch name

17.git checkout-b dev origin/dev, which acts as a remote dev branch of checkout, calls it the dev branch locally, and switches to the local dev branch

18. Cancel the global setting: git config-- global-- unset user.name

Tags: Branch file name code content configuration command action comment status mailbox switch force update two warehouse information global name point to Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Microsoft Xiaomi NVidia OPPO Reno