Last active
          June 5, 2025 02:26 
        
      - 
      
 - 
        
Save jeremypage/97d91c424dbd6e5f87ed to your computer and use it in GitHub Desktop.  
Revisions
- 
        
jeremypage revised this gist
Feb 2, 2022 . 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 @@ -23,7 +23,7 @@ git config branch.master.mergeoptions "--no-ff" ## Move branch to master without checking out ## ```sh git branch -f <BRANCH_TO_MOVE> master ``` ## Speed up Git in Windows ##  - 
        
jeremypage revised this gist
Dec 28, 2020 . 1 changed file with 3 additions and 0 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 @@ -1,3 +1,6 @@ Git cheatsheet ============== ## Find all instances of text in all commits ## ```sh  - 
        
jeremypage revised this gist
Nov 23, 2018 . 1 changed file with 6 additions and 0 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 @@ -1,3 +1,9 @@ ## Find all instances of text in all commits ## ```sh git grep "text to look for" $(git rev-list --all) ``` ## List commit messages since given commit ## ```sh  - 
        
jeremypage revised this gist
Nov 2, 2017 . 1 changed file with 6 additions and 0 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 @@ -1,3 +1,9 @@ ## List commit messages since given commit ## ```sh git log --pretty=format:%s HASH..HEAD ``` ## Config repository master branch to only accept non-fast forward commits ## ```sh  - 
        
jeremypage revised this gist
Oct 30, 2015 . 1 changed file with 3 additions 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 @@ -37,7 +37,9 @@ Notes: git diff --name-status SHA1 SHA2 ``` ## Find largest files in repo ## Saves results to text file bigtosmall.txt (From http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history)  - 
        
jeremypage revised this gist
Oct 30, 2015 . 1 changed file with 22 additions and 5 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 @@ -1,17 +1,17 @@ ## Config repository master branch to only accept non-fast forward commits ## ```sh git config branch.master.mergeoptions "--no-ff" ``` **Hint:** Don't do this on your local working copy, or everytime you do a 'pull' from origin it will create yet another explicit commit (as opposed to a simple fast-forward). ## Move branch to master without checking out ## ```sh git branch -f branchToMove master ``` ## Speed up Git in Windows ## (From http://stackoverflow.com/a/24045966) @@ -30,10 +30,27 @@ Notes: * `core.fscache` fixes UAC issues (don't need to run git as admin) * `gc.auto` minimizes the number of files in .git ## Show all changed files between two Git commits ## ```sh git diff --name-status SHA1 SHA2 ``` ## Find largest file in repo ## (From http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history) ```sh git rev-list --objects --all | sort -k 2 > allfileshas.txt ``` ```sh git gc && git verify-pack -v .git/objects/pack/pack-*.idx | egrep "^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$" | sort -k 3 -n -r > bigobjects.txt ``` ```sh for SHA in `cut -f 1 -d\ < bigobjects.txt`; do echo $(grep $SHA bigobjects.txt) $(grep $SHA allfileshas.txt) | awk '{print $1,$3,$7}' >> bigtosmall.txt done; ```  - 
        
jeremypage revised this gist
Oct 8, 2015 . 1 changed file with 1 addition and 0 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 @@ -3,6 +3,7 @@ ```sh git config branch.master.mergeoptions "--no-ff" ``` **Hint:** Don't do this on your local working copy, or everytime you do a 'pull' from origin it will create yet another explicit commit (as opposed to a simple fast-forward). ### Move branch to master without checking out  - 
        
jeremypage revised this gist
Jul 13, 2015 . 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 @@ -34,5 +34,5 @@ Notes: ### Show all changed files between two Git commits ### ```sh git diff --name-status SHA1 SHA2 ```  - 
        
jeremypage revised this gist
Jul 13, 2015 . 1 changed file with 3 additions 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 @@ -33,4 +33,6 @@ Notes: ### Show all changed files between two Git commits ### ```sh git diff --name-only SHA1 SHA2 ```  - 
        
jeremypage revised this gist
Jul 13, 2015 . 1 changed file with 6 additions 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 @@ -28,4 +28,9 @@ Notes: * `core.fscache` fixes UAC issues (don't need to run git as admin) * `gc.auto` minimizes the number of files in .git * ### Show all changed files between two Git commits ### ```sh git diff --name-only SHA1 SHA2 ```  - 
        
jeremypage revised this gist
Apr 15, 2015 . 1 changed file with 5 additions and 3 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 @@ -16,9 +16,11 @@ git branch -f branchToMove master You can significantly speed up git on Windows by running three commands to set some config options: ```sh git config --global core.preloadindex true git config --global core.fscache true git config --global gc.auto 256 ``` Notes:  - 
        
jeremypage revised this gist
Apr 15, 2015 . 1 changed file with 9 additions 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 @@ -1,6 +1,14 @@ ### Config repository master branch to only accept non-fast forward commits ```sh git config branch.master.mergeoptions "--no-ff" ``` ### Move branch to master without checking out ```sh git branch -f branchToMove master ``` ### Speed up Git in Windows  - 
        
jeremypage revised this gist
Apr 13, 2015 . 1 changed file with 18 additions 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 @@ -1,4 +1,21 @@ ### Move branch to master without checking out git branch -f branchToMove master ### Speed up Git in Windows (From http://stackoverflow.com/a/24045966) You can significantly speed up git on Windows by running three commands to set some config options: $ git config --global core.preloadindex true $ git config --global core.fscache true $ git config --global gc.auto 256 Notes: * `core.preloadindex` does filesystem operations in parallel to hide latency and will be enabled by default in future versions of git on all platforms (update: enabled in v2.1) * `core.fscache` fixes UAC issues (don't need to run git as admin) * `gc.auto` minimizes the number of files in .git  - 
        
jeremypage revised this gist
Apr 13, 2015 . 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 @@ -1,4 +1,4 @@ ### Move branch to master without checking out git branch -f branchToMove master 
 - 
        
jeremypage created this gist
Apr 13, 2015 .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,4 @@ ### Move branch to master without checking out git branch -f master branchToMove