Skip to content

Instantly share code, notes, and snippets.

View m8051's full-sized avatar
🏠
Working from home

Jordi Garcia m8051

🏠
Working from home
View GitHub Profile
@m8051
m8051 / script.sh
Created September 3, 2018 11:45 — forked from tonylukasavage/script.sh
Move all uncommitted changes to a new branch and revert the existing branch to HEAD. "master" has uncommitted changes. You decided you'd rather make those changes in "dev_branch". Here's how to move those uncommitted changes to "dev_branch" and then revert "master" to its last commit.
# get into the master branch
git checkout master
# create a new branch for the changes and check it out
git checkout -b dev_branch
# stash the changes until we revert master
git stash
# go back to master