Search code examples
gitgithubgitlabgit-flow

how to get remote updates to my local working copy in git


how do i update my local working copy of source code with current latest version of remote code?

This is the situation:

Suppose 2 people(A,B,C) are working on the project and they follows git flow..

There is master branch, and there is develop branch...everybody is pushing their updates to develop branch only..

Now A creates a feature branch (featureA) and does a commit and pushes it to remote.. B creates a feature branch(featureB) and commits and pushes it to remote.. A, and B continues their work in their remote branch... while C created a new feature branch(featureC) and completed it and finished the feature and merged it to develop

So how can A and B update their local code to get the work done by person-C?

Should a normal PULL will solve the issue?

Or should they specifically pull to the current feature branch? will VS-code automatically update the files after the PULL?

Or is some other combination of git commands?

Can some git expert please solve this dilemma?


Solution

  • Here the commands (we states that User C merged into develop and pushed it).

    User A and/or User B must:

    git checkout feature/A # Obvious!
    git fetch origin/develop
    git merge develop
    

    Or, if you want to review User C changes, so avoiding auto merge-commit, you should:

    git checkout feature/A # Obvious!
    git fetch origin/develop
    git merge develop --no-commit
    
    git diff
    
    # ... review changes: accept or discard some of them ...
    
    git commit # The commit message has been auto generated by the merge command