Vào 20:17:38 UTC+7 Thứ ba, ngày 25 tháng ba năm 2014, Remi Vanicat đã viết:
> Tu Hoang Do <[email protected]> writes:
> 
> 
> 
> > I tried amending with magit by pressing 'c' and then 'a' (for
> 
> > amend'), but instead of amending it creates two commits: an unpulled
> 
> > and unpushed commit of the same name. I just want to amend, how can I
> 
> > make magit ammend like regular amend command on terminal?
> 
> 
> 
> It did what you wanted.
> 
> 
> 
> When git amend a commit, it do not change the old one, but create a new
> 
> one, including the modified part.
> 
> 
> 
> If you had already pushed the commit you now amend, then you have two
> 
> diverted branch
> 
> 
> 
> -- * -- Original commit  (on the server)
> 
>     \
> 
>      \-- Amended commit (locally)
> 
> 
> 
> The original commit is still on the server, and is then seen by magit as
> 
> been unpulled, and the amended commit is not (yet) on the server, and is
> 
> seen by magit as unpushed. You can now force push to change what is on
> 
> the server.
> 
> 
> 
> It's generally believed you should not amend or rebase commit you had
> 
> already pushed, because if someone has already pulled the commit you
> 
> amend, he won't easily integrate you new change.
> 
> 
> 
> 
> 
> -- 
> 
> Rémi Vanicat

Thanks. So, I only need to force push to amend my previous commit.

As for git amend, it has its use. For example, working on personal project 
(i.e. my own .emacs.d), sometimes I just want to amend my previous commits with 
some missing files. Or when there are peer reviews, that is, I commit to a 
review branch before pushing to the main branch, git amend is useful to not 
making multiple commits for a change.

-- 
You received this message because you are subscribed to the Google Groups 
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to