Can you merge and push another branch using git?

My current process:

  • git checkout dev
  • make changes and commit (and sometimes click on the development branch on the origin)
  • git checkout master
  • git merge dev
  • git push origin master
  • git checkout dev

Is it possible to merge a development branch into a master instead without checking the leading branch? And then, would it be possible to press the leading branch again without checking it earlier?

eg.

  • ''
  • ''
  • merge dev in master , and in dev branch
  • click master on origin , and in the dev branch

I am trying to eliminate checks as they are somewhat slow.

+4
source share
2 answers

One simple solution would be to have 2 git repos.

  • One with a working directory derived from " git checkout master "
  • One with a working directory derived from " git checkout dev ", clone from the first

You would replace your (slow) "checkout" steps with "cd (right repo); git fetch ", before merging and clicking what you need.
I am going to make the selection much faster than checking in your case.

This solution has a cost, though (and not just to disk space, which these days is very cheap): it means potentially two development environments (two sets of parameters for the IDE editor, ...).

+1
source

If you're the only one pushing the wizard, this workflow will force you there, I think:

 #while on your local dev branch: git pull origin master #make sure there are no changes on master that aren't on your dev branch git push origin dev:master #pushes your local dev branch to the remote master branch 

This workflow will work correctly if it is only you, but it can become quite dirty if many developers are working on different sets of functions. Conflicts tend to abound in this scenario.

+1
source

Source: https://habr.com/ru/post/1315655/


All Articles