Git toolbox
Reset to specific tag
git tag
git checkout <tag_name>
git reset --hard <tag_name>
# After resetting, you should force-push the changes to update the remote repository (if you've already pushed these changes)
git push origin <branch_name> --force
Please be extremely cautious when using git reset --hard as it can result in data loss. Make sure you have backups and communicate with your team if you are working in a collaborative environment.
git reset --hard HEAD
# or
git push origin <branch_name> --force
Again, be cautious with these commands, as they can lead to data loss. Ensure that you have backups and consider communicating with your team if you’re working in a collaborative environment.
Compare local commit with remote state
git diff origin/master..HEAD
With only wiles chnged by this commit:
git diff --name-status origin/master..HEAD
Remove obsolete branch from local and remote
This is useful for cleaning up branches that are no longer needed, both locally and on the remote repository.
Gentle way:
git branch -d <branch_name>
Hard way:
git branch -D <branch_name>
Remove remote branch:
git push origin --delete <branch_name>
Set up git to use Windows certificate store for SSL verification
This is useful for Windows users to avoid SSL verification issues with self-signed certificates or internal CAs.
git config --global http.sslBackend schannel