robbin0919 / GITLAB

Git協同作業測試環境
0 stars 0 forks source link

改到一半想切去其他 branch 但又不想 commit 怎麼辦? #13

Open robbin0919 opened 6 months ago

robbin0919 commented 6 months ago

How to Switch Branch and Ignore Any Changes Without Committing?
改到一半想切去其他 branch 但又不想 commit 怎麼辦?

robbin0919 commented 6 months ago

https://gitbook.tw/chapters/faq/stash
https://linuxhint.com/switch-branch-and-ignore-any-changes-without-committing/
https://op30132.github.io/2020/01/09/git-stash/
https://stackoverflow.com/questions/1304626/switch-branch-and-ignore-any-changes-without-committing

robbin0919 commented 6 months ago

[Window Title]
Visual Studio Code

[Content]
There are no staged changes to commit.

Would you like to stage all your changes and commit them directly?

[Yes] [Always] [Never] [Cancel]

robbin0919 commented 6 months ago
git stash list  --pretty="%Cred%h%Creset -%C(auto)%d%Creset %gs %Cgreen(%cr) %C(bold blue)<%an>%Creset"

將 uncommitted changes stage 起來

git add -u .

拉回暫存的內容

git stash pop  

unstage 所有檔案

git reset