- Git: Deleting branches
Local git branches can be deleted using the git branch command with the -d or -D option. Remote git branches can be deleted using the git push command with the --delete option or :.
- Git: Pull force
There is no single command to do a forced pull from the remote. However, using git fetch --all and git reset --hard origin/<branch>, we can overwrite the changes to the tracked files, effective...
- Git not working after macOS update: invalid active developer path
macOS updates do not update the Xcode Command-line Tools by default. Unless it is updated many command-line tools like git will fail to work. It can be updated using xcode-select --install.
- Git: Undo last commit
The last commit can be undone by a combination of git reset --soft HEAD~1 and git reset HEAD .. A more destructive approach is to use git reset --hard HEAD~1.
- Git: Unadd files
To unadd one or more files from staging use the command git reset HEAD <file1
- Git: Remove untracked files
git clean is the command for deleting untracked files and directories. By default it's operations are limited to only files, using the -d option, untracked directoires can also be removed from the re...