A collection of useful Git commands and techniques to streamline your workflow, improve productivity, and enhance version control practices. This guide covers advanced features, troubleshooting tips, and lesser-known Git commands to help you work more efficiently with repositories, branches, commits, and remotes. Whether you're a beginner or an …
- Temporary Ignore a File:
To ignore a file temporarily, use:
git update-index --assume-unchanged <filename>
- Revert Temporary Ignore:
To undo the ignore command and track the file again:
git update-index --no-assume-unchanged <filename>
- See Temporarily Ignored Files:
To view the temporarily ignored files:
git ls-files -v | grep '^[[:lower:]]'
- List Remote Branches:
To list all remote branches:
git branch -r
- Delete Remote Branch:
To delete a remote branch:
git push origin --delete <branch-name>
- Rename Remote Branch:
To rename a remote branch:
git push --set-upstream origin <new-branch-name>
- Fetch All Remote Branches:
To fetch all remote branches:
git fetch --all
- Create the Orphan Branch:
git checkout --orphan <branchname>
git rm -rf .
git commit --allow-empty -m "Initial commit"