Re: removing a commit from a branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gergely Buday:

I have a problematic commit in a series of commits on a branch. It
contains adding a large binary file, which I would like to avoid to
push to our main repository. How can I remove that from the series of
commits? A command-line solution, please, if possible.

If the branch is simple (no merges and such), I'd use "git rebase --interactive branchpoint" (where "branchpoint" is where the branch is rooted), or "git rebase --interactive problematic^" (where "problematic" is the commit you want to edit, note the trailing "^" to start from its parent commit).

Then change the "pick" for the problematic commit to "edit", run the rebase, fix up the commit by using "git rm" and "git commit --amend" when it pauses, and then let it finish using "git rebase --continue".

"git --help rebase" for more information.

--
\\// Peter - http://www.softwolves.pp.se/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]