git empujando a una fusión de publicación de rama

3 minutos de lectura

avatar de usuario de vikas
vikas

Si empujo a una rama después de fusionarla con mastercómo lo manejará git (Actualice las últimas confirmaciones enviadas en la rama a master automáticamente O no hacer nada O hacer otra cosa) ?

Avatar de usuario de Andreas Dolk
Andreas Dolk

Después de la fusión, todavía tiene 2 sucursales, la que fusionó de y el que fusionaste dentroque normalmente sigue siendo tu rama activa.

La nueva confirmación irá a la rama que está desprotegida y que es maestra o la otra rama.

Tenga en cuenta que no empujar a una rama: nosotros comprometerse a una rama y empujar la rama a un repositorio remoto. Y no actualizamos las confirmaciones, agregamos nuevas confirmaciones al repositorio. confirma nunca cambio.

Suma – Claro, todavía puedes empujar a la rama “antigua”. Y fusionarlo en maestro de nuevo:

A - B - - - E - G      [master]
     \     /   /
      C - D - F        [issue_202]

Pero preferiría crear una nueva rama para solucionar los problemas. Es una cuestión de flujo de trabajo. Supongamos que el trabajo se basa en un ticket, luego el ticket problema_202 se resuelve antes de te fusionas con el maestro. Entonces, en mi opinión, el trabajo adicional no es una solución para el problema_202, sino una solución para la rama maestra, por lo que crearía un nuevo ticket y una nueva rama para solucionar los problemas:

                            F        [issue_202_1]
             / \ A - B - - - E - G      [master]
     \ / CD            [issue_202] [

  • thanks @Andreas_D , I will give some more details to explain my doubt. I had fixed some issues in branch issue_202 and pushed the branch to remote. Now the branch is merged with master, but I received further comments to the fixes done in the branch issue_202 after the merge. My doubt is whether I should checkout branch_202 and fix the issues OR checkout a new branch like branch_202_dot_1 from master, fix the issues and push the branch to master ? My basic question is after merging can we commit to a branch and push to remote ? if yes, then how will it again be merged with master ?

    – vikas

    Jul 8, 2013 at 14:01


  • @twalberg – yes, you’re right. I change my answer in that point. Of course, only the active branch receives the merge commit, the other is of course unaffected.

    – Andreas Dolk

    Jul 8, 2013 at 15:31

  • the best explanation on the internet till now 🙂

    – Almokhtar

    Sep 29, 2021 at 11:56

In Git, a commit is a snapshot of your repository plus pointers to one or more parent plus some metadata (like author, and commit message).

A branch is a pointer to some commit. That’s it.

When you push a branch, you update the remote’s pointer to point to the same commit as yours. In addition, your local repo and the remote repo negotiate what snapshots the remote is missing and sends those to the remote. Otherwise, the newly updated remote branch would point at a commit that it knew nothing about.

So, if you push a branch, only that remote branch will change. All the other remote branches will point to the exact same commits as they did before. That said, git-config(1) push.default can make it easy to push more than you expect. I recommend git config --global push.default nothing.

You should probably read up on Git Branching some more.

¿Ha sido útil esta solución?