Domanda

I am new to git and I want to start doing things 'properly'. I quite like this flow:

git checkout -b featurebranch
git commit -m "some changes" // manytimes
*
git pull // update master to origin's head
git checkout featurebranch
git rebase master // rebase my feature branch
git checkout master
git merge featurebranch --no-ff // keep branch and merge to master

But the problem I got is that I would like push changes somewhere where the * is and it brings some complications finishing my featurebranch. Simply put I can't push rebased branch because 'it is behind...'. Deleting remote origin/featurebranch or git push -f I consider as workarounds. Is there something wrong on my flow or just in my understanding to git?

I want to:

  • avoid epic merge
  • avoid branch hell (*)
  • avoid fast-forward (see commits gruped by branches)
  • backup/share my local branches (*)

I could solve this by forget one of *. Is it necessary?

È stato utile?

Soluzione

Rebasing published commits is strongly discouraged. In short, when you rebase you create completely new commit objects with different IDs (hashes).

If you wish to publish your feature branch as you are working it is much better to merge it when you are done instead of rebasing.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top