एडवांस्ड Git
Amanda Crawford-Adamo
Software and Data Engineer
Git Worktree कमांड
git worktree

यह table development workflow में git worktree बनाम git switch की तुलना करता है. $$
| Git Worktree | Git Switch |
|---|---|
| Multiple active branches | One active branch at a time |
| Separate directories | Single working directory |
| No need to stash changes | May require stashing |
<branch> से नया worktree directory <path> में बनाएँ
git worktree add <path> <branch>
उदाहरण
bugfix/data-validation branch से ../etl-bugfix directory में नया worktree बनाएँ
git worktree add ../etl-bugfix bugfix/data-validation
git worktree list उदाहरण आउटपुट
$ git worktree list
flight-pipeline a1b2c3d [main]
flight-pipeline-feature e4f5g6h [feature]
flight-pipeline-hotfix i7j8k9l [hotfix]
git worktree remove <path> उदाहरण आउटपुट
$ git worktree remove flight-pipeline-hotfix
flight-pipeline-hotfix: deleted
कब उपयोग करें:
कब पुनर्विचार करें:
Git worktrees इस्तेमाल करते समय ये tips ध्यान रखें:
एडवांस्ड Git