Rebase or cherry do you choose these commitments?
source link: https://www.codesd.com/item/rebase-or-cherry-do-you-choose-these-commitments.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Rebase or cherry do you choose these commitments?
I tried my hand at rebasing not long ago, and royally screwed myself up.
After some aborted attempts I have my files in the shape they need to be, but my commit history looks a ugly when I prepare a pull request on github:
I'd like to squash all that to a single commit before opening the PR but don't know how. If I try git rebase -i HEAD~5
I get commits from others showing in the list (probably because I merged from master at some point?)
I can't easily cherry pick since there are merge commits in there, and I have no idea how to pull that off, cherry picking involving merges.
As I mentioned, if I open a PR now the files are as they should be, but I know the repo manager is going to ask me to squash that history. I'm looking for suggestions on what to do?
Edit: in response to a request for more information, this is the graph from sourcetree, my git client. Hope it helps (I realize I'm not posting 100% information, and don't necessarily expect a silver bullet of an answer, but am hoping for an approach.)
Wow, that doesn't look good at all in the post. Here's the link to the image
I'd like to squash all that to a single commit
Then you don't need rebase
, you can simply use reset
and commit
.
git reset --soft origin/master
git commit
git reset --soft
will update your current branch to the same commit as origin/master
, but without updating your index or working tree, so after that, all of your changes are still in the index and ready to be committed again.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK