uMinded
uMinded

Reputation: 595

Git Group Workflow

I often get confused when working with git when more than one person is involved. Using it for my own projects I never use the advanced features and only push to GitHub to share publicly. I am unsure of how to resolve issues working in a community.

This is where I get unsure of things. A pull request can take a few days to be merged. If I want to keep developing where do I go?

Should I back out of my branch and open a new branch for a new issue?

What if I am working on an issue and there are important updates to the master branch? Do I pull the new master and diff my changes to a new branch from that new master?

Once my pull request is accepted I can pull the new master and abandon my local branch but synchronizing all that across two repos gets confusing.

What is the commonly accepted workflow and is there a writeup I can pin to my cheatsheet?

Upvotes: 0

Views: 82

Answers (1)

Marina Liu
Marina Liu

Reputation: 38136

The process for you to issue a pull request is correct. For your questions:

  1. After you issued a pull request to merge issue#94 to master and it’s not approved, and you want continue to develop on your local issue#94 branch. So feel free to develop on it, when you update some new things, you can push the branch again, it will automatically update the pull request you issued before. When project leader view your pull request, he will find the first and second changes you pushed.
  2. If it’s the related bugs, you can develop on issue#94 branch. Otherwise you should develop on a new branch.
  3. In your local repo, you have a remote fork repo origin, you should also add the remote repo itself for you to compare if the master branch has been updated. If the master branch updated, you only need to pull it to your local master branch and then rebase your working branch on the top of it. Steps as below:

git remote add origin2 <URL for the repo>. git fetch origin2 git diff master..origin2/master

If there has output, that means the master branch has been update, so you should do:

git checkout master
git pull origin2 master
git checkout issue#x
git rebase master
  1. The common workflow is to make sure before push the new created issue#x branch to fork repo, you show check if the fork repo is newest by git fetch origin2 master and git diff master..origin2/master. If there is no output (local master branch is newest), so you can push your issue#x branch and issue a pull request.

Upvotes: 1

Related Questions