how can I merge thus, can you help me?
it’s something crazy. i have tried to fix it last two days
One of the ways to merge it would be to create new branch where your
origin/master on the screenshot is: double click on the commit at which
origin/master is at and switch to that commit. Then press on the
Branch button at the top to create new branch, give it a name such as
mergingBranch. Then double click on your
master branch in the
BRANCHES section. Now right click on the
mergingBranch on the left there and choose
merge mergingBranch into current branch.
It will create a merge commit since it can’t fast-forward the origin/master to your master. After that you can push your changes to your origin/master and continue working.
If you don’t want to merge and want linear history without merge commits no matter what, you can use
git rebase --onto origin/master d1403431 master. This command will reapply commits after d1403431(not including the d1403431 commit, but including all after it) and master commit(including the commit at master) onto the origin/master commit.
This will result in a linear history and you can just push your changes on your current master commit to
origin/master without merging it first or losing work.
You’ll have to use the command line tool. I haven’t seen this functionality in Sourcetree. There’s rebase feature in Sourcetree, but without the --onto parameter.
git rebase and
git rebase --onto are very useful features and I recommend you to familiarize yourself with how they work before you use it:
You also want to git gud at git. The first link is a part of the book: https://git-scm.com/book/en/v2
Git is very unintuitive without understanding exactly how it works. I recommend to read chapters 1, 2, 3, 6, 7 in the book to nicely understand how it works. You don’t need other chapters: server configuration and how it works behind the scene.
It’s a very-very easy read(the Pro Git book) compared to the UE4 course on this website or C++ books like learncpp.com. These parts are only 150 pages and it should take 1-3 days of reading.