Must-know and common command collection
1. git clone [remote warehouse address]
2、git init
3. git remote set-url origin [remote warehouse address]
4. Work area, staging area, version area, remote warehouse
5、git status
6、git diff
7. git diff [file absolute path]
8、git branch
9. git branch [branch name]
10、git bran -a
11. git branch -d [branch name]
12. git branch -D [branch name] (forcibly delete local modifications but not commit)
13. git push origin --delete [remote branch name]
14、git fetch
15. git fetch origin [remote branch name]
16、git add .
17. git add [absolute file path]
18. git commit -m '[commit remarks]'
19. git commit -a -m '[commit remarks]'
20. git push origin [current branch name]
git push submits all changes to the corresponding branch without anything
21, gitk
22、hisitory
23、git log
24、git reset --hard 【commitId】
25、git checkout .
26. git checkout [absolute file path]
27. git checkout [branch name]
28. git merge --no-ff [branch name]
29、git stash
git add adds a staging area
git restore --staged components/logic/v-video/index.js (unstaged)
git diff (view workspace)
git checkout components/logic/v-video/index.js (discard)
git branch branch name (new local branch copy)
git push origin copy (local branch copy new remote branch copy)
git push origin -d delete remote branch
git branch -d delete the local branch
After adding the remote branch, others want to see the new branch git fetch and then git branch -a can see the equivalent of the fetch in sourcetree