Skip to content

Commit 8c8c2bc

Browse files
committed
**fix: Correct shell expansion in Git auto-commit alias**
The code change made here is fixing an issue with shell expansion in the GitHub auto-commit alias. The issue was that the command substitution `$(gh commit)` was getting prematurely evaluated which resulted in errors. The fix replaced it with `"\$(gh commit)"`. By escaping the `$` symbol with a backslash (`\`), the command substitution will be evaluated only when the alias is used, not when it is defined. This allows the proper function of the alias `auto-commit` within the .bashrc file. Now, the `auto-commit` Git alias works as expected, correctly executing the `gh commit` command when used. 📝🐛💻
1 parent d6165c0 commit 8c8c2bc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ gh extension install ghcli/gh-commit
1515

1616
# Create Git alias
1717
git config --global alias.auto-commit '!git commit -m "$(gh commit)" || git commit -a -m "$(gh commit)" && git log HEAD...HEAD~1'
18-
echo "alias auto-commit='git commit -m \"$(gh commit)\" || git commit -a -m \"$(gh commit)\" && git log HEAD...HEAD~1'" >> ~/.bashrc
18+
echo "alias auto-commit='git commit -m \"\$(gh commit)\" || git commit -a -m \"\$(gh commit)\" && git log HEAD...HEAD~1'" >> ~/.bashrc
1919
source ~/.bashrc
2020

2121
echo "Commit GitHub CLI extension installed successfully!"

0 commit comments

Comments
 (0)