Bash-git-commands

From I Will Fear No Evil
Revision as of 11:02, 22 October 2021 by Chubbard (talk | contribs) (Created page with "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 wit...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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