bmallred

jump to main content
Dark Mode

Git

Simple rebase

git reset --soft develop

Overwrite branch history

git reset --soft id-of-first-revision-of-branch
git commit --amend -m "new commit"
git push -f

Undo last commit

git reset --soft HEAD~1

Worktrees

To keep the .bare repository up-to-date

Create a branch from one of the main branches (master or develop) and use the --checkout flag

git worktree add --checkout develop develop

Then whenever it is necessary to refresh the bare repository

cd develop && git pull && cd -

Pull an existing branch with tracking

git worktree add --checkout <local directory> <remote branch name>

Branch from an existing branch

git worktree add --track -b <branch> <local directory> <remote>/<branch>

Remove working tree

git worktree remove --force <branch>