![]() ![]() You can found detailed explanations in this tutorial `I also get that if your work branch has been running for a while, you may rebase master into that branch periodically to keep it up to date with other changes.' This could mean a git push -f is occurring, that's a no no if you don't know what you are doing and others are using that repository it can lead to some headaches. Normally the repository should be rejecting or creating a merge conflict because the commit id's do not line up. Then the push sends the changes up to the repository. So it sounds like it resets to the commit of the workbranch and removes all other changes. Any changes to tracked files in the working tree since are discarded. This form resets the current branch head to and possibly updates the index (resetting it to the tree of ) and the working tree depending on. git checkout masterĪ quick glance at the documentation for git reset yielded the following, So up to this point everything makes sense imo, it is the long way to do things but it isn't 'wrong' Note: This is the same branch you are checking out by running git checkout master ![]() What if someone pushes changes to master before you complete the merge? Instead do the following git checkout workbranchīy running git merge origin/master you tell it to just merge the remote branch of master into your current branch. This is normally used when your workbranch needs to stay current with code that may have relevant changes you want in your workbranch.Ī better way to do those steps is to not checkout master. So the purpose of merging master into your workbranch, is to pull any changes that someone else may have pushed up. This is because someone has merged changes and pushed them to master. "and now 'master' has moved on from where it was" So I started answering this post on /r/git but it may be a better resource if I post my response here as well. My thought is that the coworker's work might get overwritten, if someone else on the team makes changes on the master branch in the same places that the coworker has edited in their branch. So the question is: does this flow have any downsides? The rest of the team does the more traditional "merge into master" or rebasing. Where the black branch would normally be master, in this image it's actually the work the coworker did on their work branch, while blue is the work done on master. This results in a network like the one below. What my coworker does is for the final merge is git checkout master git merge. I also get that if your work branch has been running for a while, you may merge master into that branch periodically to keep it up to date with other changes. when you're done, checkout the work branch, and run git merge.My understanding is that the normal flow is this: A coworker uses a git merging strategy that I'm unfamiliar with and seems kind of unusual, and I'm trying to make sure that I understand how merges work. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |