How to Use Git Worktree | Checkout Multiple Git Branches at Once

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ก.ค. 2024
  • Watch this step-by-step tutorial to learn how to leverage Git worktree and speed up your workflow. This video includes a Git worktree example, so you can learn how to use this feature to checkout and work on multiple Git branches simultaneously. We will also cover how to use Git worktree list, Git worktree add, and Git worktree remove, and provide a few tips to simplify managing multiple branches at once.
    GitLens+, featured at the end of this video, makes working with Git worktree intuitive, visual, and easier. Sign up for GitLens+ free: bit.ly/3NyFClN
    Navigate with chapters:
    0:00 Git Worktree Introduction
    0:17 Use Case for Git Worktree
    1:48 Git Worktree Concept Explained
    2:59 Git Worktree List
    3:16 Git Worktree Add
    5:49 Git Worktree Remove
    7:33 Using Worktrees in GitLens+
    #gitworktree #gitworktreeexample #gitworktreeadd #gitworktreelist #gitworktreeremove #howtousegitworktree #git #gitlens #vscode
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 26

  • @ChristerBlomqvist
    @ChristerBlomqvist 2 ปีที่แล้ว +8

    I really like your presentation style and especially that you show the actual underlying git commands.

  • @bassam.2023
    @bassam.2023 ปีที่แล้ว

    Useful tutorial, especially because you showed how things work in the background, that is, via the command line. Thanks!

  • @ahirusan1147
    @ahirusan1147 ปีที่แล้ว

    Thank you for this tutorial, it makes years I was looking for that feature!

  • @dbt6572
    @dbt6572 ปีที่แล้ว +1

    Thanks, Dwayne. Very clear.

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 11 หลายเดือนก่อน +2

    thank you, simple and to the point :)

  • @Shinwe
    @Shinwe 4 หลายเดือนก่อน +1

    Great and simple, thank you.

  • @neessaa8713
    @neessaa8713 ปีที่แล้ว +1

    10/10 tutorial! thank you very much!

    • @GitKraken
      @GitKraken  ปีที่แล้ว +1

      Glad it was helpful!

  • @mateustymoniuk
    @mateustymoniuk ปีที่แล้ว

    You saved me from getting lost in stashes and temporary local branches, thanks a lot!

  • @graciborski
    @graciborski 9 หลายเดือนก่อน +1

    Beautiful introduction

  • @chrisidema
    @chrisidema 2 ปีที่แล้ว +1

    Pretty neat. I hate stash as I can forget about it. I often create a new branch for temporary commits.

  • @jacques-dev
    @jacques-dev ปีที่แล้ว

    Does GitKraken support worktrees? I made a new worktree from the command line called `main`, and I can push pull fetch etc. just fine from the CLI. But when I open the repo in GitKraken and try to push or pull I get the following error: `could not determine remote for 'refs/remotes/origin/main'`

  • @yoavgro3
    @yoavgro3 ปีที่แล้ว +2

    I don't understand how the new work tree relates to remote. can you explain how can I push this worktree, create a pr on branches there later, etc.

  • @gersonscheffer2765
    @gersonscheffer2765 2 ปีที่แล้ว

    great video.However I think commit with a message and after use squash it is more practical than using worktree

  • @kristupasqwert9888
    @kristupasqwert9888 2 ปีที่แล้ว +1

    How would you link your node_modules with a new branch to avoid reinstalling deps?

    • @GitKraken
      @GitKraken  2 ปีที่แล้ว

      I believe the same way you would normally when working in a branch. This is just a way to move a copy of a branch to another folder and should not cause breaking changes to the node workflow. Ultimately the .git folder is tracking these branches as it always does, just has multiple referenced at once.

    • @radekkokon3720
      @radekkokon3720 ปีที่แล้ว

      Haven't tested it but I think a symbolic link to an existing node_modules directory from new branch might work.

    • @trusabaka9747
      @trusabaka9747 2 หลายเดือนก่อน

      @@GitKraken It could be a good idea for you to show the same what you have shown here with the actual say, React, project. How it will work (or not?) when the worktree is checked out? Thank you.

  • @danylohromyak5228
    @danylohromyak5228 ปีที่แล้ว

    Why does everyone use a terminal instead of a built-in vscode git GUI?

  • @amansagar4948
    @amansagar4948 8 วันที่ผ่านมา

    How is that different from cloning the repository again into a separate folder ?

    • @isaacressler8177
      @isaacressler8177 5 วันที่ผ่านมา

      In a lot of ways it's the exact same, however it enables tools like VSC to support multiple copies, like he showed. If that doesn't have any value to you it's not a tool for you.

  • @ruixue6955
    @ruixue6955 ปีที่แล้ว

    1:10
    1:22
    2:50 3 git worktree commands
    3:02 git worktree list
    3:16 git worktree add
    6:13 git worktree remove

  • @apefu
    @apefu ปีที่แล้ว +1

    I am very surprised how annoyed I get by there being no space at the end of PS1.

  • @plopplop.
    @plopplop. ปีที่แล้ว +2

    I'm annoyed by the `~` in your command line when you're not actually in your home directory.