Discussion:
[mantisbt-dev] Unnecessary Commits
Roland Becker
2014-08-10 13:15:16 UTC
Permalink
Sorry, for the noise
https://github.com/mantisbt/mantisbt/commit/ad94ddb293deeddd46a8c332dcaf525855284f76
What are the right steps to have no spaghetti history and to have no unnecessary
merge commits?

What I did
Created a clone of https://github.com/mantisbt/mantisbt

git checkout -b atrol-fix13-test_langs master
git pull ***@github.com:atrol/mantisbt.git fix13-test_langs
git checkout master
git merge --no-ff atrol-fix13-test_langs
git branch -d atrol-fix13-test_langs
git push origin master

Roland
P Richards
2014-08-10 13:44:49 UTC
Permalink
Only Rombert left now to do this ;)

I've been doing

Git checkout <branch>
Git rebase master
Git push -f grangeway <branch>:<branch>

Then going back to master:

Git checkout master
Git merge <Branch>
Git push

And making use of

git branch --merged to list any branches that have been completely merged
git branch --no-merged to show me the list of branches I need to
push/update/merge

and then making use of

git remote prune --dry-run grangeway

to identify remotes I've left dangling, git branch -rd grangeway/<branch> to
remove them manually as I'm too much of a chicken to not run prune with dry
run ;)

with "grangeway" set as a remote to my repository on github.

Probably not the most efficient, but it seems to be working out for me atm.
And using the git gui in windows to check what the tree looks like before
pushing.

I suspect Damien will write a response probably repeats what he's said
before and that tries to enlighten us on what is actually the correct method
:)

Paul




-----Original Message-----
From: Roland Becker [mailto:***@atrol.de]
Sent: 10 August 2014 14:15
To: mantisbt-***@lists.sourceforge.net
Subject: [mantisbt-dev] Unnecessary Commits

Sorry, for the noise
https://github.com/mantisbt/mantisbt/commit/ad94ddb293deeddd46a8c332dcaf5258
55284f76
What are the right steps to have no spaghetti history and to have no
unnecessary
merge commits?

What I did
Created a clone of https://github.com/mantisbt/mantisbt

git checkout -b atrol-fix13-test_langs master
git pull ***@github.com:atrol/mantisbt.git fix13-test_langs
git checkout master
git merge --no-ff atrol-fix13-test_langs
git branch -d atrol-fix13-test_langs
git push origin master

Roland

----------------------------------------------------------------------------
--
Damien Regad
2014-08-11 14:27:52 UTC
Permalink
Post by Roland Becker
What are the right steps to have no spaghetti history and to have no unnecessary
merge commits?
Please see
http://thread.gmane.org/gmane.comp.bug-tracking.mantis.devel/5109

And a follow up
http://thread.gmane.org/gmane.comp.bug-tracking.mantis.devel/5109/focus=5363
Post by Roland Becker
What I did
git checkout -b atrol-fix13-test_langs master
git checkout master
git merge --no-ff atrol-fix13-test_langs
git branch -d atrol-fix13-test_langs
git push origin master
Is mostly correct ;-)

The issue here is that git pull, basically does a fetch then a merge, so
you ended up with 2 merge commits causing your spaghetti:
- ad94ddb293deeddd46a8c332dcaf525855284f76 from the pull,
- 6412086a1bc51537dffb6c613c74faca3bb636bf from the merge --no-ff
You can avoid that by rebasing.

If you don't have it already, you should really setup a remote for your
own fork (i.e. git remote add atrol ***@github.com:atrol/mantisbt.git),
it's much better than following github's default guidelines,

Then (assuming local master branch is up-to-date with origin/master),
just do:

git fetch atrol
git rebase master atrol-fix13-test_langs
git checkout master
git merge --no-ff atrol-fix13-test_langs
git push origin

Grangeway's suggestion to force-push the branch to your github fork is
not strictly necessary, but doing it updates the pull request which may
be a good thing.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Loading...