Git - A long term cheatsheet

post-thumb

There are certain operations that belong to the standard arsenal of things to know when working with git but that simply don’t show up during day-to-day activities for regular developers. This post is going to be what I consider a “long term cheat sheet” for git so that my friends and colleagues don’t have to bug me every time they forgot how to do X although they already did it N times in the past.

Untracking files

The command git rm can be used to untrack files.

git rm <path_to_file>
git rm -r <path_to_directory>

Removing a submodule

git submodule deinit <path_to_submodule>
git rm <path_to_submodule>
git commit-m "Removing submodule X"
rm -rf .git/modules/<path_to_submodule>
comments powered by Disqus