oh-my-git/levels/stash/en/stash-branch

49 lines
835 B
Text
Raw Normal View History

2021-01-05 16:44:17 +01:00
title = Branch from stash
cards = checkout commit-auto merge reset-hard
[description]
If you want to keep your changes but they don't belong to the main branch, you can easily
2021-03-20 17:32:15 +01:00
create a new branch from your stashed changes. Just use
2021-01-05 16:44:17 +01:00
git stash branch <branchname> <stash>
If you just want to use the latest stash entry, you can leave the <stash> option empty.
Create a new branch from the stashed changes!
---
tipp1
---
tipp2
---
tipp3
[setup]
echo "Apple Pie:" > recipe
git add .
git commit -m "creating a recipe"
echo "- 4 Apples" >> recipe
git add .
git commit -m "Adding ingredients"
echo "- 500g Flour" >> recipe
git stash push
git checkout main
[win]
2021-03-10 07:17:26 +01:00
# Did you create a new branch from the stashed changes?
2021-01-05 16:44:17 +01:00
test "$(git branch --list| wc -l)" -ge 2
[actions]
[congrats]
2021-03-10 07:17:26 +01:00
Stashed changes are in a new branch! :)