16

1. Cancel this pull

git reflog

image-20211123115003360

reset to a certain version

git reset --hard 91ae6ad

image-20211123115138013

2. Cancel this merge

If you merge other branch codes and cause a lot of conflicts, you want to cancel this merge.

image-20211123121252778

1. Use the reset command above to undo to the last submitted version

2. Execute the following command to directly cancel the local merge

git merge --abort

3. High-level usage of git log

View the file modification list submitted every time, and the graphical information of branch changes

git log --name-status --oneline --graph

image-20211123142821089

General query usage

git log

image-20211123142912632

4、git stash

In normal development, if a part of the local branch is developed, but the branch needs to be switched, or the code needs to be pulled, how to complete the pull or branch switch without submitting the modification?

git stash can temporarily store the current work status (WIP, work in progress) in the stash list, and then reapply these changes from the stash after the pull/merge operation is completed.

The -u parameter indicates that the newly added file is also stash

git stash save -u 'message'

\# View how many WIPs have been temporarily stored in the stash list

git stash list

\# Restore the last WIP status and remove it from the list

git stash pop

image-20211123143742546

image-20211123143942657

5. How to undo the modification

1. The use of checkout when revoking a newly created file or directory does not take effect

. represents the files in the current directory and all subdirectories

git clean -fd .

image-20211123144851627

Undo the specified file or directory

git clean -fd file or directory

image-20211123145140777

2. Cancel the local update code modification

git checkout .

This is very commonly used, so I won’t repeat it too much.


兰俊秋雨
5.1k 声望3.5k 粉丝

基于大前端端技术的一些探索反思总结及讨论