Lojacho
Lojacho

Reputation: 11

Manage multiple branches

  1. When I started to code I had two branches Main and PopUp.
  2. I was working in the PopUp branch but I had to stop because I need to work in another feature.
  3. In order to work in this new feature I create another branch called Form.
  4. I finished the work in Form branch and I also merged in to the main branch, after that I delete this branch.
  5. Now I am continuing working in the PopUp branch but I cannot see the changes that was implemented by the Form branch.
  6. When I move to the main branch I can see the changes implemented by the Form branch.
  7. But when i move again to the PopUp branch I cannot see this changes.

Could you please help me in order to see this changes from the PopUp branch but I dont want to lose the work that I have in the Pop Up branch.

The changes made in the form branch are totally separate (another section in HTML, here I also create a separate JS file and also a separate CSS file ) that the work that I am doing in the popUp branch but I would like to see the changes.

Thanks Happy coding ;)

When I move to the PopUp branch and check it with git status told me that is uptodate. I use terminal to interact with github.

Upvotes: 1

Views: 195

Answers (2)

Lojacho
Lojacho

Reputation: 11

In order to solve this problem when I return to the popUp branch I merge this branch with the main branch. Thanks

Dai shadowtalker

Upvotes: 0

shadowtalker
shadowtalker

Reputation: 13903

Git provides a nice, albeit under-appreciated, solution to this problem: you can create secondary "work trees" for your repository, each with a different checked-out branch.

See the 'worktree' tag and in particular What would I use git-worktree for? for good descriptions and discussions on this topic.

This is a legitimate use case and it comes up all the time. The typical recommendation is to use git stash in order to switch from working on one task to the other, but I find this incredibly disruptive. Having multiple Git worktrees has been a lifesaver many times when I was in the middle of working on something, and I needed to switch branches for a quick bugfix.

Upvotes: 1

Related Questions