Git
Last update: February 3, 2023
To be honest I now use GitFox App but those can always be useful.
Change commit date
git commit --amend --no-edit --date "$(date)"
Using VSCode as git editor and diff tool
git config --global diff.tool vscode
git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"
git config --global core.editor "code --wait"
Submodules
git submodule add dist.git local_dir
And checking out submodules after cloning
git submodule init
git submodule update
Bisecting workflow
git bisect start
git bisect bad # actual commit
git bisect good <commit> # last good commit
then git bisect good/bad regarding the case
git bisect reset
git branch --track LOCAL_NAME remotes/origin/DIST_NAME
Follow a branch
git fetch origin branch-dist:branch-local
Add a branch
git push origin branch-name
Delete dist branch
git push origin :branch-name
Checkout tag
git tag -l
git checkout tags/<name>
Git merge with parent
git remote add parent <parent-url>
git pull parent
Create a new repository for collaboration
On the distant server (and accessible from ssh):
git init --bare
On the local machine:
git clone ssh://serveurdistant/full/path/name.git name
git add
git commit
git push origin master
if the local repository was already started:
git remote add origin ssh://distant_server/full/path/name.git
git branch --set-upstream-to=origin/master master