# Git Worktree with Scaffold-Eth too

By [tekh](https://paragraph.com/@quantumtekh) · 2023-07-16

---

### Versions

2023.09.10 - updated local repo setup to include a cd

Overview
--------

this document will describe how to create a scaffold-eth 2 project with a remote fork and a local worktree

The following examples are based off the following forked se-2 repo:

[https://github.com/OwlWilderness/se-2](https://github.com/OwlWilderness/se-2)

Prerequisites
-------------

*   Visual Studio Code
    
    [https://code.visualstudio.com/download/](https://code.visualstudio.com/download/)
    
*   GitHub Account **\[your-github\]**
    
    [https://github.com/](https://github.com/)
    

Remote Repository Setup (Github)
--------------------------------

### Fork Scaffold-Eth 2 Repo

1.  Navigate to se-2 repo
    
    [https://github.com/scaffold-eth/scaffold-eth-2](https://github.com/scaffold-eth/scaffold-eth-2)
    
2.  Click the Fork button to create a fork in **\[your-github\]**
    
3.  Name your **\[forked-repo\]**
    

![ fork se-2 repository](https://storage.googleapis.com/papyrus_images/7f577391b596ac4d2b589463055587df57273e9ab276579f49b23eb4c25dac11.png)

fork se-2 repository

![name new forked-repo](https://storage.googleapis.com/papyrus_images/149b8f98994aa9a75e08b47b4604374c5c7880433b73197f39c8ce0a05491644.png)

name new forked-repo

Local Repository Setup
----------------------

1.  Create a local **se-2** folder to contain projects
    
    **_example:_**
    
        PS C:\git> md se-2
        
    
2.  In **se-2** Clone \[your-github\] \[forked-repo\] into a local **main** branch
    
    Navigate to the se-2 folder and clone your forked repo into a new main folder\*./se-2>\* git clone [https://github.com/](https://github.com/)**\[your-github\]/\[forked-repo\]**.git **main_example:_**
    
        PS C:\git\se-2> git clone https://github.com/OwlWilderness/se-2.git main
        
    
3.  In **main** Add Worktree for new Project Branch
    
    When creating a new project navigate to the main branch and execute the worktree add command. Specify a branch name and folder location. (the below example will put the folder in the same directory as main)
    
    **_example:_**
    
        PS C:\git\se-2\main> git worktree add -B project1 ../project1
        
    
4.  Change Directory to new Project
    
        PS cd ../project1
        
    
5.  Push to origin
    
    **_example:_**
    
        PS C:\git\se-2\project1> git push --set-upstream origin project1
        
    

Outcome
-------

The folder structure should look like the following.

![local folder structure](https://storage.googleapis.com/papyrus_images/35b347b3321b40e5fb69a56c8a290bae5691012b058d8769b9415290dbb204ac.png)

local folder structure

The contents of each folder should contain the scaffold-eth main project.

![project folder contents](https://storage.googleapis.com/papyrus_images/1836abb0fd86b7e868d0fce801ca7cff477e95b3f41d9d459a86ded0d2d0b17f.png)

project folder contents

The remote git repository will contain the new branch.

![git hub forked repo branches](https://storage.googleapis.com/papyrus_images/d97fcdcc261736fa9cd19de378767d0973770b950b7dcd0b4d3cdb8a940b7da7.png)

git hub forked repo branches

Reference Articles
------------------

[https://mirror.xyz/news.buidlguidl.eth/O\_Gc84QO4TjvxJnunkRr-s-It1qBTK7TMlJcWf4FQ\_I](https://mirror.xyz/news.buidlguidl.eth/O_Gc84QO4TjvxJnunkRr-s-It1qBTK7TMlJcWf4FQ_I)

[https://mirror.xyz/news.buidlguidl.eth/8Lx4pV-h2yk6mu5C5UZVPjfOtVwknLmB8bd7114kaxI](https://mirror.xyz/news.buidlguidl.eth/8Lx4pV-h2yk6mu5C5UZVPjfOtVwknLmB8bd7114kaxI)

---

*Originally published on [tekh](https://paragraph.com/@quantumtekh/git-worktree-with-scaffold-eth-too)*
