Tips for working with git on Camel branches

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Tips for working with git on Camel branches

Claus Ibsen-2
Hi

When pushing to master branch or any branch for the matter. Then
please do a rebase first and apply your commits on top of the latest
code.

We want the git tree to be clean and not a "merge hell".

So what I usually do is

git pull --rebase

To have all the latest code from master, and then if there is
conflicts or what, then I fix them locally, and then I push on top of
that.

Or if you work on feature branches then

git co master
git pull --rebase
git merge --no-ff mybranchname
git pull --rebase

And I also have a git squash alias I used to compact N number of
commits (not always) but its good

git squash 3 (to compact last 3 commit into 1 - editor opens and you
can edit the commit message)

squash => !f(){ git reset --soft HEAD~${1} && git commit --edit
-m"$(git log --format=%B --reverse HEAD..HEAD@{1})"; };f


Anyone got other tips?


--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Tips for working with git on Camel branches

Omar Al-Safi
Ah awesome! +1.
Sorry for my earlier commit

On Wed, Feb 5, 2020 at 11:02 AM Claus Ibsen <[hidden email]> wrote:

> Hi
>
> When pushing to master branch or any branch for the matter. Then
> please do a rebase first and apply your commits on top of the latest
> code.
>
> We want the git tree to be clean and not a "merge hell".
>
> So what I usually do is
>
> git pull --rebase
>
> To have all the latest code from master, and then if there is
> conflicts or what, then I fix them locally, and then I push on top of
> that.
>
> Or if you work on feature branches then
>
> git co master
> git pull --rebase
> git merge --no-ff mybranchname
> git pull --rebase
>
> And I also have a git squash alias I used to compact N number of
> commits (not always) but its good
>
> git squash 3 (to compact last 3 commit into 1 - editor opens and you
> can edit the commit message)
>
> squash => !f(){ git reset --soft HEAD~${1} && git commit --edit
> -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"; };f
>
>
> Anyone got other tips?
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>