I've branched to work on a feature. Let's call it feature-branch. Now I want to merge ALL of the changes on that branch, and I mean - the whole shebang - into my master branch?
So, I start by checking out the master branch and then choose "Merge" but I am invited to pick one commit from feature-branch. I can't select ALL the commits.
If I choose the most recent commit from feature-branch, will that merge it AND all the committed changes that occured before it? I guess not, cos the most recent commit only has certain changes and anything before it is recorded in a separate, previous commit.
How do I merge ALL the changes from feature-branch into master?
Thanks!
Hi @therealjimrichards !
I'm not following your third paragraph. The way Git works is that changes are cumulative. The next commit should be made up of all of the changes from previous commits and whatever new things you have added and staged. Thus, when merging from your feature branch to master, it'll use the most recent commit.
Can you show a series of diff output that shows that's not the case?
Hi @Robert Wen_Cprime_ thanks for your reply. I think my answer is encapsulated in your phrase: "changes are cumulative", thus if I choose the most recent commit, that'll have the effect of bringing all the previous commits with it if I merge from that point.
I find it a bit confusing because I was under the impression that commits were separate "steps" in the history of the repo since it's possible to revert an individual commit without that revert necessarily having a knock-on effect on any commits that follow.
In other words, when you revert a commit you don't "rewind" to that point - you instead just reverse the changes detailed in that commit, which is useful but is counter-intuitive to the idea that changes are cumulative.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm hoping a trip to the Git manual will help. https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.