I am doing all my development in development branch

I have two branches namely master and development in a GitHub Repository. I am doing all my development in development branch as shown.

git branch development
git add *
git commit -m "My initial commit message"
git push -u origin development

Now I want to merge all the changes on the development branch into the master . My current approach is:

git checkout master 
git merge development
git push -u origin master 

Please let me know if the procedure I am following is correct.

Hello,

usually you don’t push your topic branches to origin, but to your own fork. But yes, this is how you do merging with merge commit, but in Foreman we do not allow merge commits (we enforce --ff-only).

I recommend you to google out free book called “Pro Git”.

1 Like

My typical workflow is this:

git checkout -b my_cool_feature origin/develop
<make changes>
<commit changes>
git push jturel my_cool_feature
<open pull request>

where ‘jturel’ is a remote pointing at my fork of the codebase:

[vagrant@centos7-devel foreman]$ git remote -v
jturel  ssh://git@github.com/jturel/foreman.git (fetch)
jturel  ssh://git@github.com/jturel/foreman.git (push)
upstream        https://github.com/theforeman/foreman.git (fetch)
upstream        https://github.com/theforeman/foreman.git (push)

If there are new changes that I want to include in my local branch, I rebase after committing everything locally:

git fetch upstream
git rebase upstream/develop
1 Like