Git workflow - merge master before or after pushing to public repo?

Here's what I have right now:

1 Github remote (origin)
2 Heroku (staging and production)

      

The workflow looks like this:

First time (setup):

1 - Fork public Github (upstream) into public Github <br>
2 - Clone from public Github into local

      

Development workflow:

1 - Checkout feature-branch from local master
2 - After all commits, squash them
3 - Push that branch (with one commit) into origin
4 - Do a pull request to public Github
5 - Merge into public Github master
6 - Do a pull of master into local
7 - Do a rebase here??
8 - Push local master into Heroku Staging (do testing...)
9 - Push local master into Heroku Production

      

This is what they suggested to me, but I have some doubts. After executing a pull request and merge with the public Github master (upstream), I pull the master to the local one, why is there a rebase here? Shouldn't I do a reinstall before redirecting the feature branch to the beginning?

Another doubt is that once I have attempted from the master master to the local branch, shouldn't I push that master at its original position (my forked repository)?

EDIT . Here you can see the workflow in the diagram: Diagram workflow

Thank you for clarifying these doubts.

+3


source to share


1 answer


First of all, git rebase is dangerous for shared code. Rebasing is actually rewriting history, which will also change the commit hashes. This means that git might think that a commit made in the past needs to be reapplied (when you are using code), and this can become a major headache. I avoid repacking most of the time.

I would prefer to have 2 different remote urls for the source. One for pushing and one for retrieving. The fetching remote will be the main repository, and push-remote will be the forked repository. This way you pull the last master from the main repository, squash with your branch, push the master branch into the forked repository, and then simply request a pull request.

You can set the url to the main repository like this:

git remote set-url origin <main_repo_url_here>



And after that set the forked url only for such clicks:

git remote set-url --push origin <forked_personal_repo_url_here>

You can check your results like this:

git remote -v

+2


source







All Articles