Unstage all files staged for commit
git reset HEAD -- .
Revert to previous commit, discarding all changes made locally
git reset --hard HEAD
Stage only files that match a given regex
find . -name ' <regex here>' | xargs git add
Example (stage all files with extension .fr.resx )
find . -name ' *.fr.resx' | xargs git add
Add a submodule to existing Git repository
git submodule add < gitRepositoryUrl> < path>
git submodule add https://github.com/INKolevTest/BootstrapThemes.git Source/Web/Web/Content/BootstrapThemes
git commit -m " Added BootstrapThemes submodule"
git push
Make a submodule visible in the existing Git repository
Command (execute in the root folder where the .git
directory is)
git submodule init
git submodule update
init
makes git go through your .gitmodules
file and automatically adds an entry to .git/config
for each submodule
update
clones the specified submodules into our repo (the parent project)
Update submodule and parent repo in one step
git push --recurse-submodules=check
Create alias for some operation
git config alias.pushall " push --recurse-submodules=on-demand"