Git pull non-working branch without switching

We have a development branch, which is our master and a separate service branch. I often have to pick up worms from the master to maintenance, or vice versa, when I correct errors. I usually do this by following the procedure ...

  • Lock Lead Branch
  • Push commit to remote
  • Switch / Checkout to the service branch
  • Cherry-select commit from step 1
  • Build and make sure everything still works as intended
  • Click the "Save" button for remote control.

The problem I am facing is that the branches have become significantly diverging. I have to rebuild the entire project every time I switch, which takes up to 10 minutes. This is expected, but I would not want to do this, as I often switch between branches. Therefore, to avoid this, I created a second working directory to have a directory for each branch. The problem is that I can’t cherry-pick the original command order in the service catalog, until I pulled this commit into the leading branch of the service catalog from the remote. When I do this, I have to completely rebuild.

Is there a way to pull commits into the main branch of my service directory without switching? Or is there a better way to do this whole thing? We recently switched to Git from CVS, so I am not familiar with this.

+4
2

, dirs, , - , . , , ( ) , .

git ( >= 2.5), git worktree, . .

(git < 2.5) git-new-workdir script git .

0

, fetch ( ):

git fetch origin

fetch , , master , origin/master . , - :

git cherry-pick origin/master

( , , , , , , , , , ?)

+1

Source: https://habr.com/ru/post/1621341/


All Articles