No Comments Git

[Git] Automatically add branch name on commits.

In order to have a more readable log, I generally prefer to add the branch name in each commit. It gives something in this flavor:
[myCurrentBranch] Some interesting things I fixed.
But it’s a pain to manually add it each time. Moreover each thing you manually do is human and then error prone. Let’s automatize that as good and lazy engineers / programmers as we are…

HowTo:

In your repository, rename the hook .git/prepare-commit-msg.sample to .git/prepare-commit-msg
Add the following code just before the “case”:
branchName=`git rev-parse --abbrev-ref HEAD`
echo "[$branchName] " > "$1.msg"
cat "$1" >> "$1.msg"
cat "$1.msg" > "$1"

Less things to type! Hurray!

No Comments Git

[Git] Remember credentials on git operations

Tired of entering your ID / password each time you do a git operation?
Here you go if you are on Windows:

Note: if you are using CygWin, you may change the following block with a CygWin style path:
[credential]
helper = !'C:\\Users\\myUserName\\AppData\\Roaming\\GitCredStore\\git-credential-winstore.exe'

into
[credential]
helper = !'/c/Users/myUserName/AppData/Roaming/GitCredStore/git-credential-winstore.exe'