Skip to content

Instantly share code, notes, and snippets.

@victusfate
Created October 26, 2023 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victusfate/6662335665490758720e7ff8f9c40937 to your computer and use it in GitHub Desktop.
Save victusfate/6662335665490758720e7ff8f9c40937 to your computer and use it in GitHub Desktop.
convert_last_commit_to_different_branch.txt
# Stash the changes: This will take your current changes and stash them.
git reset HEAD~1
# Copy code
git stash
#Switch to the desired branch:
git checkout [branch-name]
# Apply the stash to the branch:
git stash apply
# Or, if you want to apply the stash and drop it from the list of stashes:
git stash pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment