[git-users] Re: git --amend doesn't seem to work as I anticipated

2021-09-02 Thread SJW
I amended the commit and then re-merged and the amended commit did not merge

On Thursday, 2 September 2021 at 19:02:01 UTC+10 philip...@iee.email wrote:

> > Do amends not merge? 
>
> In general, don't try to `--amend` a merge. It would produce an evil merge 
> (i.e. something in a notionally clean merge that wasn't actually present in 
> either branch). As best I remember, if you try to amend a merge you only 
> get an updated single parent commit, rather than a merge. (try a bit of 
> experimentation to check)
>
> If the merge was clean (make this easier), it's better to rewind/rollback 
> to just before the 'merge', apply the --amend to the branch, and then 
> remerge. (--amend is a squash for a single commit rebase ;-)
>
> The 'rerere' database (if enabled) can help with tricky merges (it 
> remembers the previous conflict resolutions!), but it's documentation is 
> horrendous/next to useless, despite it being real magic [sufficiently 
> advanced technology]
> On Thursday, September 2, 2021 at 12:21:06 AM UTC+1 SJW wrote:
>
>> I have been working on a feature-branch - made a few commits and ready 
>> for testing.
>>
>> I `git checkout staging` branch, merge in feature-branch and then push it 
>> to the staging server.
>>
>> While testing in staging I realise I have left some logging on or 
>> something else minor.
>>
>> I checkout feature-branch again and remove the logging BUT this time when 
>> committing, instead of a brand new commit, I use `git commit --amend`
>>
>> I `git checkout staging` branch again, merge in feature-branch again and 
>> then push it to the staging server. BUT ... the last changes committed via 
>> `--amend` are not present.  This isn't the first time this has happened so 
>> I am guessing it's not something I have done, it's actually a "feature" of 
>> git. Is this correct? 
>>
>> Do amends not merge?
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/b4a20183-c010-44b8-bd08-451edb988d89n%40googlegroups.com.


[git-users] Re: git --amend doesn't seem to work as I anticipated

2021-09-02 Thread Philip Oakley
> Do amends not merge? 

In general, don't try to `--amend` a merge. It would produce an evil merge 
(i.e. something in a notionally clean merge that wasn't actually present in 
either branch). As best I remember, if you try to amend a merge you only 
get an updated single parent commit, rather than a merge. (try a bit of 
experimentation to check)

If the merge was clean (make this easier), it's better to rewind/rollback 
to just before the 'merge', apply the --amend to the branch, and then 
remerge. (--amend is a squash for a single commit rebase ;-)

The 'rerere' database (if enabled) can help with tricky merges (it 
remembers the previous conflict resolutions!), but it's documentation is 
horrendous/next to useless, despite it being real magic [sufficiently 
advanced technology]
On Thursday, September 2, 2021 at 12:21:06 AM UTC+1 SJW wrote:

> I have been working on a feature-branch - made a few commits and ready for 
> testing.
>
> I `git checkout staging` branch, merge in feature-branch and then push it 
> to the staging server.
>
> While testing in staging I realise I have left some logging on or 
> something else minor.
>
> I checkout feature-branch again and remove the logging BUT this time when 
> committing, instead of a brand new commit, I use `git commit --amend`
>
> I `git checkout staging` branch again, merge in feature-branch again and 
> then push it to the staging server. BUT ... the last changes committed via 
> `--amend` are not present.  This isn't the first time this has happened so 
> I am guessing it's not something I have done, it's actually a "feature" of 
> git. Is this correct? 
>
> Do amends not merge?
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/f7f2ea54-3433-42fa-a05c-f560efae0f53n%40googlegroups.com.