Skip to content

Git Commands

Eugene edited this page Oct 4, 2022 · 3 revisions

Stop Tracking Changes to Versioned File in Git

Stop tracking changes to "filename.txt" but do not removing it from Git
git update-index --assume-unchanged "filename.txt"

Start tracking changes to "filename.txt"
git update-index --no-assume-unchanged "filename.txt"

Disable Push to Git Repository

Disable the ability to push changes to a remote Git repository. Useful when you want to allow students to work on some software, but do not want them to push their modifications.
git remote set-url --push origin no_push

Clone a Specific Branch

git clone --branch <branchname> <remote-repo-url>

Prune Non-Existent Branches

Delete remote branches that no longer exist
git remote prune origin

Delete local branches
git branch -d <local_branch>