-
Notifications
You must be signed in to change notification settings - Fork 2
Git
Go back 'x' revisions back on a file:
git checkout HEAD~x Makefile
Search for a specific string changed during all history:
git log -S'get info' -p
Go back 'x' revisions back:
git checkout HEAD~x
Go back to a previous commit and uncommit it, keeping any changes done until that commit:
git reset --soft HEAD^
Add new submodule
git submodule add URL DIRECTORYSubmodules info
git submodule statusUpdate all submodules:
git submodule update --recursive --remoteClone newly added submodules See: 1 and 2
git submodule sync
git submodule update --init --recursivegit mv old/submod new/submodView submodules differences
git diff --submodule=diffDownload only a part of a repository:
https://github.com/lodash/lodash/tree/master/test ➜ https://github.com/lodash/lodash/trunk/test
svn checkout https://github.com/lodash/lodash/trunk/testMake the current commit the only commit in a git repo
git checkout --orphan newBranch
git add -A # Add all files and commit them
git commit
git branch -D master # Deletes the master branch
git branch -m master # Rename the current branch to master
git push -f origin master # Force push master branch to github
git reflog expire --all --expire=now # remove hidden refs
git gc --aggressive --prune=all # remove the old files
git commit -m "First commit"
git push -f origin master
Doing this didn't reduce the repo size at all
Remove file from all commits:
bfg --delete-files FILE_WITH_SENSITIVE_DATA PATH_TO_REPO
cd some-big-repo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git pushRemove folder from all commits:
bfg --delete-folders FOLDER_WITH_DATA PATH_TO_REPO
cd some-big-repo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git pushWhen having a problem with git commits because of size (it will uncommit everything from current branch "local")
git reset --soft origin/HEAD
Here you'll find all things i've learnt from linux thus far, enjoy!
Git