Temporarily work for other branches, temporarily store the working status of the current branch
Currently has two branches, master
and dev
;
You dev
are doing your own work on Shanghai, and others need you master
to fix a bug on Shanghai. At this time, you need to temporarily record dev
the work status of the branch;
command: git stash-about working status
On the dev
above, execute the following command to temporarily store dev
the working status of the branch
# use git stash to save current working status.
git stash
When the master
branch finishes work and returns to the dev
branch, execute
# show all working status
git stash list
# recover the lastest working status you need and delete that.
git stash pop
Do the same modification to dev
Suppose you find that after the modification on the master is completed, since dev is a continuation of the previous master, the same modification operation is required on dev. Do you need to perform the operation again?
The answer is NO (not necessary).
Git tracks changes . It provides commit
a command that can be copied a certain time
# cherry pick :把樱桃捡起来。是不是寓意着把某次小的提交copy过来呢
git cherry-pick <commit id>