I'm trying to push my commit, but couldn't since there is another commit (same-level in the HEAD race :)
I know I need to merge those two commits together, not exactly sure how to do it.
I already tried git pull --rebase
.
My GIT-CLI:
When you perform a git rebase operation, you're typically moving commits around. Because of this, you might get into a situation where a merge conflict is introduced. That means that two of your commits modified the same line in the same file, and Git doesn't know which change to apply.
While this happens, conflicts may arise. These are conflicts between your code changes in the PR and other changes that got merged into the target branch. What you could do is merge the changes from the target branch into your PR branch. That will however give a lot of merge commits and isn't very clean.
Merging is a safe option that preserves the entire history of your repository, while rebasing creates a linear history by moving your feature branch onto the tip of main .
All you need to need to do is solving the conflict you see mentioned at the end of your pull --rebase
.
See "HOW CONFLICTS ARE PRESENTED": you will have to open those files, and remove the conflict markers.
For the .tern-port
file, you need to decide if you want to keep your file, and remove it, as it has been removed in the upstream repo.
I forgot to configure my
.gitignore
file.
If you realize that because of tracked files that should not be tracked, don't forget to un-track them first, before adding them to your .gitignore
git rm --cached -- afile
echo afile >> .gitignore
git add .gitignore
That can be done during your conflict resolution stage.
Once that stage is done, add them (git add .
), and continue the rebase (git rebase --continue
).
After that, if the git status
is clean, you can push.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With