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
global
Branch
2.1. Usegit worktree
to create a worktree for theglobal
branch in a separate directory:
git worktree add ../worktree-global global
2.2. Verify the worktree setup:
git worktree list
- Test the Setup
3.1 Install the conda environment usingenvironment.yml
in the main branch 3.2: Run the Python Script. In themain
branch directory, run the script:
python test.py
From Baishen Liang baishen.liang@duke.edu liangbs95@gmail.com