E
E
Eugene2015-11-09 16:41:16
git
Eugene, 2015-11-09 16:41:16

What is the correct way to work with a branch after git push --force?

During development, we have the following scheme of working with git:
- local copy
- some-devel - developer's working branch on the server
- dev - general development branch
- master - pre-production
for each developer has its own subdomain somedevel.dev.site where its
general branch is auto-deployed the development branch also auto-deploys
. The principle also applies: each task has a branch, after its test it merges into the general
one in its somedevel branch, I often do git push --force to show this or that branch, or different options,
and I pour it into the general development branch already neat commits using git rebase -i HEAD~
The question is how to autodeploy your subdomain to get the current version of the branch, if the branch is often flooded git push --force
If you do git pull, then it tries to merge, which only interferes
Really git fetch; git checkout origin/somedevel ?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2015-11-09
@magiota

Is git fetch; git checkout origin/somedevel ?

Well, or git fetch && git reset origin somedevel --hard
you understand that --forcethis is ... not good.
Try to rearrange your development approach a little so that you don't have to do push --force (although in principle there is nothing wrong with this, with your flow). Are you the type to constantly rebase each other's branches?

A
Alexey, 2015-11-10
@CheatEx

Option two:

  1. Track tags according to some pattern. This is simpler and will not give interesting effects in case of human error.
  2. Make a separate repository for such brunches. For developers, respectively, somedevel is pushed into it and not into the main one. Cover the main repository accordingly with hooks that prevent force. Difficult, but will fit into any CI and should not give surprises.

R
rutaka nashimo, 2015-11-09
@rutaka_n

you shouldn't have auto-deployed from branches, it would be much more convenient to deploy an arbitrary branch with an arbitrary commit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question