Remotely Stash Git Commits
Let's say you're in the middle of working on some code, and you need to stop working immediately.
You don't want to make a half-finished commit, and you can't stash, because you would like to resume your work on a different machine.
Here's what I do to "stash" a draft commit or a series of commits remotely:
# Doing some work
# ...
# Gotta head out! Force everything into the remote origin/draft branch
git commit -am "draft: in the middle of a refactor"
git push origin +master:draft
Then, from a different workstation:
git pull upstream draft && git reset HEAD~1
Now my draft commit is pulled in, and unstaged allowing me to continue my work and then make nice commit(s) once I've reached a logical conclusion.
Written by Aleksey Smolenchuk
Related protips
1 Response
Cool !!!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#