1

I got the instructions on how to deploy the app to Git and Heroku, but because I am not very familiar with Git (I know just the "basics"), I would like to ask you about a little help. I have downloaded the app from Heroku. Here's what I should to do:

Create separate git branches for new updates, push the branch to Github, create pull requests and merge them into master.
Then pull the master branch locally and deploy to Heroku.

What should be the right workflow? After a research:

git branch new_branch
git push origin new_branch
git fetch new_branch
git merge master/new_branch
git push heroku...

Could you correct me, please, about the workflow?

Thank you

asked Jan 2, 2013 at 10:16

1 Answer 1

1

The correct workflow after cloning / pulling your app would be:

git branch new_branch
git checkout new_branch
### Now you can make changes, develop your update
git commit -am "some message"
git push origin new_branch

To merge the branch into the master you can do:

git checkout master
git merge new_branch

And you can push/deploy it whereever you want, for instance heroku in your example. Hope this helps..

answered Jan 2, 2013 at 11:15
Sign up to request clarification or add additional context in comments.

8 Comments

Thank you for your message gulty. If I made some changes before creating the new branch, is that a problem? And then, after git checkout master and git merge new_branch I should deploy the app, not before?
Well, if you create a new branch it clones the current branch you are on (e.g. master) into a new branch with exactly the same data inside. So you can do all the changes you like before. Exactly the current development status will be taken into the new branch. About the deployment it is up to you and depends what you want to accomplish. If for instance your master is taken for your live app you should of course merge your new_branch into master to have this feature live before deploying the master branch. You could also create a DEV branch and merge new_branch in that for testing purposes.
So if I already made some changes and now I would like to create a new branch and push there these new changes, is too late for doing that, am I right? So for now I just have to push these changes into the master branch and afterwards if I will push some new updates into a new branch, I have to first to create the new branche and then do some coding?
Ok, so you have changes made in master but you don't want to push them yet, you want to have these changes in a new branch? That's no problem, you can stash the changes made and apply them to your new_branch. Like that: 1)git stash 2)git checkout new_branch 3)git stash list // see stashed things.. 4)git stash apply x // select the stash u wanna apply to new_branch
One question yet - git push origin new_branch - why is there origin? Shouldn't be there master?
|

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.