Last active
October 4, 2021 13:36
-
-
Save bitsandbytes/4429e0906e70709c396c to your computer and use it in GitHub Desktop.
Git Secrets
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 characters
| Git Secrets | |
| # how to find the commit that deleted a file | |
| # find a file that you're not certain where it is anymore, if it's been deleted | |
| git log --all --full-history -- "*MyFile.*" | |
| # find the path of the above | |
| git show --pretty="" --name-only <sha1-commit-hash> | |
| # now limit the above file's commits to just the exact path you want | |
| git log --all --full-history -- <path-to-file> | |
| # take the last commit, that'll show you the commit that deleted the file | |
| git show <sha1-commit-hash> -- <path-to-file> | |
| # remove last commit from git _and_ filesystem | |
| git reset --hard HEAD^ | |
| # remove last commit but keep files locally | |
| git reset HEAD^ | |
| # switch to new remote repo | |
| git remote add new-origin git@github.com:mobdata/md-build.git | |
| git remote rm origin | |
| git remote rename new-origin origin | |
| # comparing 2 branches while also removing unwanted files from what's shown | |
| git diff ded756f ef62f1a -- $(git diff --name-only ded756f ef62f1a | grep -Ev "package-lock.json") | |
| # change author date when doing interactive rebase, so that author date is "now" instead in way past | |
| # this is untested at the moment. | |
| # Do interactive rebase | |
| # Choose edit | |
| # Use `git commit --amend --date="now"` | |
| https://stackoverflow.com/questions/454734/how-can-one-change-the-timestamp-of-an-old-commit-in-git/454750 |
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 characters
| https://phoenixnap.com/kb/how-to-install-git-on-centos-7 | |
| sudo yum install https://centos7.iuscommunity.org/ius-release.rpm | |
| sudo yum install git2u-all | |
| # then found I needed to remove these conflicts | |
| sudo yum remove git git-core perl-Git | |
| # then ran again | |
| sudo yum install git2u-all |
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 characters
| [user] | |
| name = Timothy D. McKernan | |
| email = timbitsandbytes@gmail.com | |
| [alias] | |
| br = branch | |
| c = commit | |
| co = checkout | |
| st = status | |
| lol = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s\\ %C(cyan)\\ [%cn]\\ %d" --decorate --date=short | |
| ll = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ (%cn)\\ %C(cyan)%s\\ %C(cyan)%b%Creset" --decorate --date=short | |
| [pull] | |
| rebase = true | |
| [core] | |
| editor = vim -u NONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment