Bash-git-commands
Jump to navigation
Jump to search
Git commands that are useful for bash scripts.
Retrieve the hash for the current commit inside whatever branch we are in This also works for submodules as long as you are within the submodule directory in question
git rev-parse HEAD <pre> Change the git remote from http(s) to git@ can be done this way: <pre> sed -i 's|https://URL/|git@URL:|g' ./.git/config
If you want to update the submodules
sed -i 's|https://URL/|git@URL:|g' ./.gitmodules sed -i 's|https://URL/|git@URL:|g' ./.git/modules/PATH/config