简体   繁体   中英

Git for visual studio 2015, delete intermediate commit

Im new using GIT...While working with it, i have created intermediate commits just in the case my computer crash or something like that, so i have a commit history like this in a new branch

frmClients - crud Operations final
frmClients - crud Operations tmp3
frmClients - crud Operations tmp2
frmClients - crud Operations tmp1

I would like to know if there is a way to delete those intermediate commits (from tmp1 to tmp3) and keep only the last one, i didnt merge&push it yet to the server.

Doing a revert or hard reset wont do what i want. Or mayb im using git in a wrong way?

Rebase is your friend here:

git rebase -i HEAD~4

Replace the second to fourth lines starting with "pick" to "f" for "fixup", and you'll end up with a single commit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM