-1

I was working on a branch "feat/plan" which was taken from branch "dev" and after committing the changes I pushed my code to the master branch "dev". But now I need that changes to push to a branch named feat/api which is taken from dev branch.

So I need to know how can I push my changes from branch "feat/plan" to branch "feat/api".

  • 1
    Check [this](https://git-scm.com/docs/git-push#Documentation/git-push.txt-ltrefspecgt82308203). You can use `git push :`. Be careful, though. Maybe try it with `--dry-run` first to see what would be pushed exactly. – Romain Valeri Sep 29 '21 at 14:25
  • 1
    Does this answer your question? [Push commits to another branch](https://stackoverflow.com/questions/13897717/push-commits-to-another-branch) – Eng_Farghly Sep 29 '21 at 15:37

1 Answers1

1

If your master branch is "dev" and your branch "feat/api" is taken from dev branch after your last push code, so you don't have to push your changes from branch "feat/plan" to branch "feat/api", it contains all the changes!

It not, just try to cherry pick the commits you want into your "feat/api" branch. That will pull just this commit into your current branch.

git cherry-pick <commid-id>