Git legend for dropping branches

Scenario:

Person A creates an experimental branch to solve the problem. Person B is interested and wants to check the code, because of the lazy person A pushing him to github rather than setting up his workstation to allow person B to pull straight from him.

A and B hack, person C sees activity on github and clones, wanting to check what is happening. Meanwhile, A and B complete their terrible decision, and delete the branch . But man C manages to turn the idea into something great and wants to share. Merging hell begins with the fact that branch C no longer has a common ancestor with its purpose of merging.


I am wondering how this script should be handled.

  • Is there an accepted naming convention for branches indicating that - even if it is pressed - this branch may well be completely destroyed. A way for person A to point out that "if you pull for it, I cannot guarantee continued happiness."
  • Or is there even a way (command) in git that allows me to sort tag branches how to throw it away?
  • Is it easy, regardless of circumstances, to change the history of git if someone could get it out of it?
  • Should person A take the time to properly configure his workstation to allow person B to pull right from him? Thus, it happens in the dark, not letting anyone else know what they are working on.
  • Perhaps the only viable solution is old-fashioned communication; just talk to peers.

And if all else fails, what is the right strategy for person C in this case? How can changes be applied correctly when your work is done on a disabled schedule?

+4
source share
3 answers

The merger of hell begins with the fact that the C-branch no longer has a common ancestor with its purpose of merging.

Of course, the master branch has an ancestor (in its history) for the remote branch.

C can pull the branch to github, where A can pull it again. What is wrong with that? or C can merge / redirect in a new branch (on top of master A) and, again, let A pull it out.

update (response to comments).

Deleting a branch does not actually rewrite the history, at least not in a way that prevents merging.

I assume that person A had this story:

a--b--c--d--e--f--g master | x--y--z experiment 

So, after deleting the branch, it still has commits from a to c, probably this is more like:

 a--b--c--d--e--f--g--h--i--j--k master 

Person C supposedly has:

 a--b--c--d--e--f--g master | x--y--z--w--v--q experiment 

This is a perfectly reasonable scenario when a merger should not be so bad.

For example, person C can be pulled out of the master and combined the experiment into it.

+2
source

There is no official convention yet.

One good example of a flip branch (mentioned in this article on Git rebase since March 2010) is the pu git.git branch.

Git Frequently Asked Questions :

The pu branch is often not accelerated because some commits have been completely deleted in it since the last click.

If you want to track it, add a plus sign (+) to the corresponding line in the .git/config file, for example:

 [remote "origin"] fetch = +refs/heads/pu:refs/remotes/origin/pu 

What git tells you to solve this problem, just skip the fast forward check ( overwrite the old file with the new one ).
Or you can simply delete this line completely if you don't want to track the pu branch at all.

We can assume that in future versions of git we might want to mark some branches of “this is expected to be rewound” explicitly and make the cloning operation a note to automatically give out a plus sign.

Thus, one of the ideas is to actively prevent (through hooks) any clicking on these drop branches, making them:

  • only for reading
  • Updated by only one administrator.
+4
source

Each attendant is responsible for their own plug. You cannot assume that the other committer did or didn’t do anything good.

You can see the information if the committer and the author are not the same person.

If you do not want a patch, you can return it to your own plug.

0
source

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


All Articles