diff --git a/site/cs/tools/git.typ b/site/cs/tools/git.typ new file mode 100644 index 0000000..04452a3 --- /dev/null +++ b/site/cs/tools/git.typ @@ -0,0 +1,85 @@ +#import "/lib/lib.typ": * +#set document(title: [Git]) +#metadata(( + title: "Git", + translation_key: "git", + summary: "What's git and lot of usefull command" +)) +#calepin.setup(eval: false) + += What's Git +This is git + += Bascis command +TODO: +- fetch +- pull +- push +- commit (with sign) +- checkout +- rebase + + += Config +Git config live in `~/.gitconfig` + +== User +In User section, we can specify default `name` and `email`: +```yaml +[user] + name = Rémi Heredero + email = remi@heredero.ch +``` + +== Signing +To sign commit and tag by default, you can set the flag on the configfile: +```yaml +[commit] + gpgsign = true +[tag] + gpgSign = true +``` +You also probably want to specify your default gpg key in the user section: +```yaml +[user] + signingkey = 4A8C1907D8B15B47 +``` + +Sometime (often in windows), you need to specify the path of the gpg program with: +```yaml +[gpg] + program = C:/Users/her/dev/GnuPG/bin/gpg.exe +``` + +== Default editor +You can define a default editor to edit commit message or solve conflict. In my case, my favourite code editor is Zed, so: +```yaml +[core] + editor = zed --wait +``` + +== Include If +You maybe want a different config for some repo. It's easy to do that with `includeIf`. You can define a gitconfig overlay to apply to a specific repository: +```yaml +[includeIf "gitdir:"] + path = ~/.gitconfig-work +``` += Advanced command + +== Reset author +If you didn't use the right config for commiting somewhere, you can reset the author of commit with the following command. + +=== Single commit +```sh +git commit --amend --no-edit --reset-author +``` + +=== Entire project history +```sh +git rebase -r --root --exec "git commit --amend --no-edit --reset-author" +``` + +=== From a specific commit +```sh +git rebase -r --exec "git commit --amend --no-edit --reset-author" +```