DEV Community

Takahiro Fukushima
Takahiro Fukushima

Posted on

Use git pull --rebase origin develop when you pull latest develop branch

git pull --rebase origin develop

What a useful command!
When you join develop team, you always use git.
But...
When you complete code and push it to remote repository, you look conflict message, so it slightly sad.

Then Whenever you use git pull --rebase origin develop.

Condition

Development team must follow Git-Flow.
It's branch strategy.

main branch
develop branch
feature branch
Enter fullscreen mode Exit fullscreen mode

When use it

First you create new feature branch.
Second you're coding.
Third you enter git pull --rebase origin develop, after Lunch.
So develop branch may have been updated.

It's also good when coding is done, you enter it.

If there is nothing else,

Successfully rebased and updated xxxx
Enter fullscreen mode Exit fullscreen mode

OK, No Conflict.
Let's push it.

But you catch conflict message, you fix code.

You enter blow command after you fix it.

git add fixed file
Enter fullscreen mode Exit fullscreen mode

You enter blow command.

git status
Enter fullscreen mode Exit fullscreen mode

If it's no conflict,

nothing to commit, working tree clean
Enter fullscreen mode Exit fullscreen mode

Ok, next you enter blow command, so you finish rebase.

git rebase --continue
Enter fullscreen mode Exit fullscreen mode

If It's no problem,

Successfully rebased and updated xxxxxx
Enter fullscreen mode Exit fullscreen mode

How about it?
It's easy way.
But you carefully research rebase and pull, so you use command.

Have a good engineer life.

Top comments (0)