E
E
egyptForce2019-04-24 13:52:36
git
egyptForce, 2019-04-24 13:52:36

How to reschedule a commit?

there are two branches master, dev. locally by mistake committed to master instead of dev. How can I transfer this commit from the master to dev. commit made locally and not pushed

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Evgeny Samsonov, 2019-04-24
@egyptForce

Push commit to dev

git checkout dev
git cherry-pick <hash>

Rollback the last commit
git checkout master
git reset --soft HEAD^

D
Dmitry Shitskov, 2019-04-24
@Zarom

git reset HEAD~1
git checkout dev
git add -A
git commit

A
Askhat Bikmetov, 2019-04-24
@askhat

git checkout master
git rev-parse HEAD <- Ctrl+C
git checkout dev
git cherry-pick [Ctrl+V]
git checkout master
git reset HEAD~1 <- сбрасываем последний коммит
git checkout -- . <- сбрасываем состояние директории

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question