locked
GIT workflow confusion RRS feed

  • Question

  • User379720387 posted

    Using VS2017 CE.

    Worked on a handfull of files in the master branch. Have not done any staging.

    Create a branch, check the branch out and stage 2 out of the 5 files, then commit.

    Repeat for two other branches and now all changes have been staged and committed.

    Now I go back to master branch and merge the branches which works. However I have to know which branches have committed changes that still need to be pushed. Which seems odd.

    After I hit SYNC I see the 3 commits I made, plus the three attempts to merge. Odd!

    I have not yet pushed.

    Is this the way to do things? If not, how can I back track from where I am at?

    Sunday, May 14, 2017 6:51 PM

All replies

  • User-2057865890 posted

    Hi wavemaster,

    1. Create a branch for the changes you plan to make and give it a name, such as fix-bug-3214 or cool-feature-x.
    2. Commit changes to your branch. People often have multiple commits for a bug fix or feature.
    3. Push your branch to the remote repository.
    4. Create a pull request so other people can review your changes. To incorporate feedback, you might need to make more commits and push more changes.
    5. Complete your pull request and resolve any merge conflicts from changes other people made after you created your branch.

    Review potential changes from a merge or rebase by comparing branches directly. You can compare both local and remote branches, which is useful when checking for potential merge conflicts or to see how the changes others have made will affect your work.

    Review history
    https://www.visualstudio.com/en-us/docs/git/tutorial/history

    Undo changes
    https://www.visualstudio.com/en-us/docs/git/tutorial/undo

    Save work with commits
    https://www.visualstudio.com/en-us/docs/git/tutorial/commits

    Best Regards,

    Chris

    Monday, May 15, 2017 2:55 AM
  • User379720387 posted

    Thanks for taking the time to shed some light on my predicament.

    There is no team here: one coder and one tester. Pull request seems overkill for my scenario, as it adds unnecessary complexity.

    1. Is it a problem if the branches are created after changes were made?

    your points 3-5 are all related to large teams, how would that work if I wanted to complete the merge of the branch locally so the tester just sees the merged code?

    Monday, May 15, 2017 12:28 PM
  • User-2057865890 posted

    Hi wavemaster,

    Pull does a fetch and then a merge to download the commits and update your local branch in one command instead of two. Use pull to quickly bring your branch up to date with the remote when you aren't worried about reviewing the changes before merging them into your own branch. For details, see https://www.visualstudio.com/en-us/docs/git/tutorial/pulling.

    Best Regards,

    Chris

    Tuesday, May 16, 2017 8:53 AM