Git: track a remote branch

Here is the point: you have a git repository a random guy forked your repo and made a pull request You want to rework his contribution locally before merging it On your local repo, add the random guy forked repository address and name it random-guy: git remote add random-guy You can see the remote repo you added with this command: git remote show Add the remote branch where the random guy did the pull request and name this branch pr-rework (for Pull Request rework)....

June 7, 2022 · 1 min · JC

Memo git config

Everytime I configure a new PC or env, I search for this: git config --global "John Doe" git config --global "johndoe@domain.tld" git config --global gpg.program gpg git config --global pull.ff only git config --global commit.gpgsign true git config --global init.defaultBranch main git config --global push.default current git config "johndoe@domain.tld"

November 27, 2021 · 1 min · JC

Memo vim config with powerline

Powerline install: sudo apt install powerline python3-powerline fonts-powerline Vim config: " All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by " the call to :runtime you can find below. If you wish to change any of those " settings, you should do it in this file (/etc/vim/vimrc), since debian.vim " will be overwritten everytime an upgrade of the vim packages is performed. " It is recommended to make changes after sourcing debian....

November 27, 2021 · 2 min · JC

Update author and email in git history

Imagine you have already made some commits in a git repo and you want to update your mail address and/or your name ? In short, you want to re-write git history with good informations. Here is a script who can do that. Put here in parent folder of git repo you want to edit: #!/bin/sh git filter-branch --env-filter ' OLD_EMAIL="incorrect-email@domain.tld" CORRECT_NAME="Your Name" CORRECT_EMAIL="good-email@domain.tld" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] then export GIT_COMMITTER_NAME="$CORRECT_NAME" export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] then export GIT_AUTHOR_NAME="$CORRECT_NAME" export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" fi ' --tag-name-filter cat -- --branches --tags This script will search for all commits done by incorrect-email@domain....

February 24, 2021 · 1 min · JC