Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

commit to wrong branch git solution

# undo the last commit, but leave the changes available
git reset HEAD~ --soft
git stash -m "your stash message"
# move to the correct branch
git checkout name-of-the-correct-branch
#check the stash list first
git stash list 					//press q to  quit the 
git stash pop stash@{n}   		//where n is stash number to of your message
git add . 						//or add individual files
git commit -m "your message here"
# now your changes are on the correct branch
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #commit #wrong #branch #git #solution
ADD COMMENT
Topic
Name
9+9 =