I didn't wish to git revert - it would create an additional commit, giving Git the upper hand. Now it had re-added a most recent unneeded commit to master I wished to remove, so proceeded like so. Exiting with no changes, I charged my battery then proceeded to shave, as all 900+ individual commits nonchalantly rebased - resetting their commit times to now.ĭetermined to beat Git and preserve the original times, I deleted this local repository and re-cloned from the remote. I grew a Silicon Valley beard while 900+ commits loaded themselves into Sublime. I git rebase -i -root'ed my branch, ignorantly thinking I could reword the first commit differing from the master (the GitHub for Windows default view is the comparison to master, hiding it's entirety). Lastly, if you need to find a commit that you "deleted", it is typically present in git reflog unless you have garbage collected your repository. It will reset you back to the most recent commit, and erase all the changes in your working tree and index. However, both commits will be in the log.įYI: git reset -hard HEAD is great if you want to get rid of WORK IN PROGRESS. If you already pushed, it may be better to use git revert, to create a "mirror image" commit that will undo the changes. Because when they pull, it will just merge it into their work, and you will get it pushed back up again. However, if others may have pulled it, then you would be better off starting a new branch. If you already pushed it, you will need to do a force push to get rid of it. Or, you could look at the output of git log, find the commit id of the commit you want to back up to, and then do this: git reset -hard Careful: git reset -hard WILL DELETE YOUR WORKING DIRECTORY CHANGES.īe sure to stash any local changes you want to keep before running this command.Īssuming you are sitting on that commit, then this command will wack it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |