I'm not good at git yet. I want to ask you, how the rebase with remote repo should be made.
I mean, I have main branch (remote) and I also have branch eg. my_branch (local). When PR for merging my_branch to main was open, there was few more commits added to main that causes conflicts on my_branch.
So, I always:
But, it creates in the PR weird commit history and also adding these to my PR. I don't want it. I would like to rebase my_branch with main, push it to the remote repo and won't see these commits that was added to main when my PR was open for a while.
How can I change it? I know that there is a way, but I don't understand it correctly. Anyone can explain?
Thanks in advance.
In a situation where I have a branch my_branch
out of which I later want to make a pull-request I usually follow this workflow:
main
has new commits:
my_branch
onto the remote main
, resolving conflicts if they appearmy_branch
my_branch
(using --force-with-lease
if I have already pushed before)Now my work is present in the remote and I can create a pull request out of that branch or just have it sitting there for a while as a backup.