Worktree Demo with Git and Python
This document outlines how to set up a Git repository with worktree and manage Python files across branches.
- Create a blank folder and clone the repository:
git clone https://github.com/Baishenliang/test_gitworktree.git cd main
- Add a Worktree for the
globalBranch
2.1. Usegit worktreeto create a worktree for theglobalbranch in a separate directory:
git worktree add ../worktree-global global2.2. Verify the worktree setup:
git worktree list
- Test the Setup
3.1 Install the conda environment usingenvironment.ymlin the main branch 3.2: Run the Python Script. In themainbranch directory, run the script:
python test.py
From Baishen Liang baishen.liang@duke.edu liangbs95@gmail.com