git remote show origin
git remote prune origin
git push -d origin <branch>
git branch -d <branch>
git commit -m "Something terribly misguided"
git reset HEAD~
<< edit files as necessary >>
git add ...
git commit -c ORIG_HEAD
git rebase -i --rebase-merges HEAD~
git checkout -b [name_of_your_new_branch]
git checkout <rev> -- file/to/restore
git log --no-merges master..
git diff --cached
git show --name-only <rev>
git log --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
git add -p
:git checkout --patch
git blame <file> <rev>
git gui blame
git
in another directory:git <cmd> -C <path>
git update-index --assume-unchanged <path>
git bisect <last_good_hash>
git add ./\*.json
git clean -f
git diff -w --no-color
git apply --cached --ignore-whitespace
git checkout -- .
git reset
git rebase -X theirs <branch>
ours
or theirs
):git checkout --ours <file>
git reset HEAD [path]
git reset <file>
git reset --hard
git reset <hash> --soft
git stash save <message>
git stash -u
git stash list
git stash clear
git stash push -m <name> <path>
git stash show -p
git log --follow
git log -- path/to/folder
git log -i -Gtext --name-only
git log --all --grep='text'
Create a .gitconfig
file in the repository root
Then include manually the config file:
git config --local include.path "../.gitconfig"
Author => write the code
Committer => commit the code
The author is the person who originally wrote the patch, whereas the committer is the person who last applied the patch
<rev1>..<rev2>
Include commits that are reachable from <rev2>
but exclude those that are reachable from <rev1>.
When either <rev1> or <rev2> is omitted, it defaults to HEAD.
<rev1>...<rev2>
Include commits that are reachable from either <rev1> or <rev2>
but exclude those that are reachable from both.
When either <rev1> or <rev2> is omitted, it defaults to HEAD.
git filter-repo --analyze
.git\filter-repo\analysis
path-deleted-sizes.txt
git filter-repo --force --invert-paths --path-glob "path/to/file"
git remote add origin https://github.com/xxx/zzz.git
and then git push --force
git filter-repo --mailmap mailmap.txt
Name For User <email@addre.ss>
<new@ema.il> <old1@ema.il>
New Name And <new@ema.il> <old2@ema.il>
New Name And <new@ema.il> Old Name And <old3@ema.il>
git filter-repo --replace-text exp.txt
exp.txt
containing:p455w0rd
foo==>bar
glob:*666*==>
regex:\r\n \* @author xxx==>
regex:\bdriver\b==>pilot
literal:MM/DD/YYYY==>YYYY-MM-DD
regex:([0-9]{2})/([0-9]{2})/([0-9]{4})==>\3-\1-\2
will go through and replace p455w0rd with REMOVED, foo with bar, any line containing 666 with a blank line, the word driver with pilot (but not if it has letters before or after; e.g. drivers will be unmodified), replace the exact text MM/DD/YYYY with YYYY-MM-DD and replace date strings of the form MM/DD/YYYY with ones of the form YYYY-MM-DD. Every line has a replacement, given by whatever is on the right of ==>. If ==> does not appear on the line, the default replacement is REMOVED. If multiple matches are found, all are replaced.
Download the jar here: https://rtyley.github.io/bfg-repo-cleaner/
Clone the full repo, amke a copy of it:
git clone --mirror
Put the data to remove in a text file and then:
java -jar bfg.jar --replace-text passwords.txt
All the commits and branch will have this data removed except the HEAD.
Pull requests will not be modified