0

I am working on a project on Github. The project has many branches, but there are only two needed to mention: develop and docs my job is to push my codes to docs branch, and my issue is if someone pushes code to develop how can I have those changes in docs and resume working without issues.

In pseudocode terms:
guy a: works in develop
guy b: checks out docs and works on this branch
guy a: is ahead of docs by adding more stuff
guy b: wants to synchronize docs with develop so he can work on guy a's changes

elektra
  • 55
  • 2
  • 19
  • 1
    Either merge `develop` into `docs` or rebase `docs` onto `develop`. I would opt to rebase the feature onto the main branch but people have their own opinions on this, figure out what works for you. – Jeff Mercado Nov 03 '20 at 09:11
  • That depends on what workflow you want to use. You can either use [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) or [merge](https://git-scm.com/docs/git-merge). – kapsiR Nov 03 '20 at 09:12
  • Does this answer your question? [Git merge master into feature branch](https://stackoverflow.com/questions/16955980/git-merge-master-into-feature-branch) – Joe Nov 03 '20 at 09:22

1 Answers1

0

In your case: guy a: works in develop guy b: checks out docs and works on this branch guy a: is ahead of docs by adding more stuff guy b: wants to synchronize docs with develop so he can work on guy a's changes

On the docs branch:

git merge develop
Jackkobec
  • 5,889
  • 34
  • 34
  • Hi Thanks. I do get this error message `Automatic merge failed; fix conflicts and then commit the result.` – elektra Nov 03 '20 at 15:11
  • This is normal situation. You have conflicts on the common code from the branches. Resolve conflicts and commit resolving result. After that you will have a fresh information from the merged branch. – Jackkobec Nov 03 '20 at 18:14
  • I can't resolve issues, that's my problem. I don't even know what the conflict is or what it means – elektra Nov 09 '20 at 10:02
  • Conflict means what the same code(the same code lines) have been changed in both branches. Conflict resolving means to choose what changes will be applied(from what branch) – Jackkobec Nov 09 '20 at 10:41
  • Thanks. I understand this now. Can you please check my newest noob question? https://stackoverflow.com/questions/64756108/git-detached-head-while-checking-out-a-valid-branch – elektra Nov 09 '20 at 17:12
  • The best way is to read and practice the git official manual in Branching and Merging part: https://www.git-scm.com/docs After that your question will be more concrete. – Jackkobec Nov 09 '20 at 22:39