Skip to content

Instantly share code, notes, and snippets.

@egustafson
Last active September 15, 2016 17:03
Show Gist options
  • Save egustafson/76393ef3df716c5bb75f4661d15fd05d to your computer and use it in GitHub Desktop.
Save egustafson/76393ef3df716c5bb75f4661d15fd05d to your computer and use it in GitHub Desktop.
git stash on a true branch
# 1. Store the "stash" on a branch
git checkout -b my-stashing-branch ## checkout, creating the branch
git add <the files to 'stash'>
git commit -m "comment" ## you now have the files on a branch
git push -u origin my-stashing-branch ## and saved in your central repo (GitHub)
# 2. Use your "stash" branch somewhere else.
git checkout somewhere-else
git merge my-stashing-branch --no-commit --no-ff ## origin/my-stashing-branch if new clone.
git reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment