Question

Lets say that I push a branch B to the server with commits C1 and C2 and continue working on commits C3. Then other programmer push to B two commits, C4 and C5 and I get notified. My question is, what is the recommend actions or commands, to integrated easily those two new commits in my work in progress C3 commit? I mean, I have my working directory full of unfinished and "uncommitable" work, but want base my future work on commit C3 in what others programmers push to remote B, in this case commit C4 and C5. BTW, I'm using Git ;)

Was it helpful?

Solution

The first question to ask is whether you really need the commits C4 and C5 to continue your work on C3. If you don't require them immediately, then don't worry about it, continue your work, and merge them later.

If you require C4 and C5 and you have work you don't want to commit yet for C3, then you can do:

  • git stash your work in progress
  • git fetch B to fetch local copies of branches from B
  • git merge B/C5 to get commits C4 and C5 (resolving any conflicts if necessary)
  • git stash pop to restore your work in progress (again resolving any conflicts)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top