Force pull #
git fetch
git reset --hard origin/master
shell
Assume unchanged #
git update-index --assume-unchanged exam.ple
shell
Upgrade git for windows #
git update-git-for-windows
shell
Delete tag #
git tag -d tagname
git push --delete origin tagname
shell
Remove submodule #
From https://stackoverflow.com/a/1260982/8810271
- Delete the relevant section from the
.gitmodules
file. - Stage the
.gitmodules
changes:git add .gitmodules
- Delete the relevant section from
.git/config
. - Remove the submodule files from the working tree and index:
git rm --cached path_to_submodule
(no trailing slash). - Remove the submodule's
.git
directory:rm -rf .git/modules/path_to_submodule
- Commit the changes:
git commit -m "Removed submodule <name>"
- Delete the now untracked submodule files:
rm -rf path_to_submodule
Split repo #
Single File #
From https://stackoverflow.com/questions/39479154/how-can-i-split-a-single-file-from-a-git-repo-into-a-new-repo Use git fast-export.
First, you export the history of the file to a fast-import stream. Make sure you do this on the master branch.
cd oldrepo
git fast-export HEAD -- MyFile.ext >../myfile.fi
shell
Then you create a new repo and import.
cd ..
mkdir newrepo
cd newrepo
git init
git fast-import <../myfile.fi
git checkout
shell
Sub Directory #
git filter-branch -f --prune-empty --subdirectory-filter path/to/module
shell
How to make file +x in Git on Windows? #
From https://stackoverflow.com/a/21694391/8810271
git update-index --chmod=+x foo.sh
sh