Last active
December 5, 2023 11:17
-
-
Save gidhon/3e38fdbf681adb7199a1 to your computer and use it in GitHub Desktop.
Revisions
-
Gideon Kreitzer revised this gist
Aug 13, 2014 . 1 changed file with 1 addition and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,12 +18,4 @@ You have made some commits, pushed it upstream to the remote branch, then realiz 7. this will merge all the changes from the old branch into the new one while ignoring the commit history 8. do a status update to see what's cooking - `git status` 9. you may now re-stash/add, starting with a clean slate -
Gideon Kreitzer renamed this gist
Aug 13, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Discard commits while saving changes = ## Scenario You have made some commits, pushed it upstream to the remote branch, then realized that some or all of those commits must for some reason not be included. In example, accidently commiting large multimedia files (blobs) that will forever bloat the commit history of the branch. 1. ensure all changes are commited in your current, "faulty" branch 2. switch to your master branch -
Gideon Kreitzer created this gist
Aug 13, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ Discard commits while saving changes = ## Scenario You have made some commits, pushed it upstream to the remote branch, then realized that some or all of those commits must for some reason not be included. In example, accidently commiting large multimedia files that will forever bloat the commit history of the branch. 1. ensure all changes are commited in your current, "faulty" branch 2. switch to your master branch - `git checkout master` 3. update master with latest changes on remote - `git pull origin master` 4. create a new branch and check in to it - `git checkout -b <new-branch-name-squash>` 5. ensure you're in the new branch - `git branch` 6. merge changes from "faulty" old branch into this new branch - `git merge <old-faulty-branch> --squash` 7. this will merge all the changes from the old branch into the new one while ignoring the commit history 8. do a status update to see what's cooking - `git status` 9. you may now re-stash/add, starting with a clean slate then switch to master and create a new branch: git checkout master git pull origin master git checkout -b google_glass_squash then make sure you're in the new branch: git checkout google_glass_squash then merge in your changes in your google glass branch into your new branch: git merge google_glass_squash --squash um hang on sorry that last one should be: git merge google_glass --squash which will merge all your changes in google_glass into your new google_glass_squash branch, and ignore the history