Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <instagibbs_> hey my IRC bouncer is being stupid, here i am
- <instagibbs_> need some assistance splitting the commit?
- <emilengler> Ok nice, yes I do^^
- <emilengler> I'm currently in the getblockbyheight branch on my local repository
- <instagibbs_> ok so if it's the last commit you can always `git reset HEAD~`
- <instagibbs_> which will "back out" the commit but keep the diff
- <emilengler> git log shows only one commit now
- <instagibbs_> `git diff`
- <emilengler> The "rpc: Add getblockbyheight"
- <instagibbs_> should see all your changes in last commit
- <instagibbs_> right?
- <emilengler> I got this output "Unstaged changes after reset:
- <emilengler> M src/rpc/blockchain.cpp
- <emilengler> M test/functional/rpc_blockchain.py
- <emilengler> "
- <instagibbs_> luckily these changes are in two files which makes this easier. Next you can `git commit src/rpc/blockchain.cpp -m "fixup! rpc: Add getblockbyheight"`
- <instagibbs_> after that `git diff` should only show the test changes
- <instagibbs_> from there `git commit -am "rpc: Add test for getblockbyheight"`
- <instagibbs_> you'll have 3 commits
- <instagibbs_> tell me if you make it there or are confused
- <emilengler> I made it, git log now shows 3 commits
- <instagibbs_> ok great, and one is a fixup! right?
- <instagibbs_> now my favorite mode of operation: `git rebase -i HEAD~3` which means "interactive rebase the last 3 commits"
- <emilengler> Yes, but I did a small typo hope it isn't a big deal. I've forgot the space after "rpc:"
- <instagibbs_> will give you a commit list of 3 last commits
- <instagibbs_> it's fine
- <instagibbs_> you'll se esomething like :
- <instagibbs_> pick deadbeef Commit message
- <emilengler> I know
- <emilengler> I think I need to change the pick
- <instagibbs_> correct
- <instagibbs_> 2nd pick to "f" aka fixup
- <instagibbs_> drops the commit message and squashes
- <instagibbs_> f(ixup) both work. s(quash) keeps the commit message
- <instagibbs_> then exit and save changes, should be good to go
- <emilengler> So on line to "pick" => "fixup"
- <instagibbs_> yep, or just "f"
- <emilengler> Done
- <instagibbs_> ok you should have two good-looking commits now
- <emilengler> Yes I do
- <instagibbs_> once you're satisfied force-push to your repo
- <instagibbs_> ok, sorry if im patronizing
- <instagibbs_> not sure of git level
- <instagibbs_> of expertise
- <emilengler> Done
- <instagibbs_> now, if the two sets of changes were in one file, the fix is a bit more subtle
- <instagibbs_> instead of `git commit` those two files separately, I use `git add -p <filename>` which lets you pick and choose the sub-parts
- <emilengler> Ok, thank you a lot :-)
- <emilengler> Can I post this chat on github (As a link to a pastebin)?
- <emilengler> So others can benefit from it in future
- <instagibbs_> sure
- <emilengler> Ok thanks :)
Advertisement
Add Comment
Please, Sign In to add comment