my-awesome-project
- git-technical-directory
- new-feature
- hotfix
Start with a directory and clone your remote:
git clone --bare [email protected]:myname:my-awesome-project.git .bare
echo "gitdir: ./.bare" > .git
Next up, you can add branches as worktrees with:
git worktree add new-feature
git worktree add hotfix master
The directory should look something like this now:
my-awesome-project
- .bare
- .git
- new-feature
- hotfix
https://morgan.cugerone.com/blog/how-to-use-git-worktree-and-in-a-clean-way/
This is, for instance, usefull when having a file tracked by git with secret contents.
You can have the file in your repository with defaults and then change your local data.
--skip-worktree
will help to keep git status
silent without the need to actually ignore the file.
git update-index --skip-worktree <file_name>
git update-index --no-skip-worktree <file_name>