Issue with committing

I was working on the project from an environment local on my Laptop. However I committed yesterday from this environment, since then I get a message as shown in the screenshot. What can I do to fix it and to be able to commit again?
Bildschirmfoto 2022-05-11 um 16.15.42

Changes that are present on the remote server but not in your local repository copy must be integrated into your local repository first via git pull before git lets you push any new commits. git pull does two things:

  1. Fetches new data from the remote repository (i.e. the changes you pushed from your laptop)
  2. Merges the new commits into your local branch.

Git pull comes up with this:
Bildschirmfoto 2022-05-11 um 16.33.18

Use git config pull.rebase false and try again. The option tells git how it shall merge the commits together. Apparently no default option is selected yet, so git refuses to merge until you specify an option.

When I type this command nothing happens and git status still gives the same message as in the beginning.

You must use git pull again after configuring.

now there is this message, how can these conflicts be fixed:
Bildschirmfoto 2022-05-11 um 16.48.05

Disclaimer: Merge conflicts in git can be troublesome for inexperienced users, so before you read the following, save a copy of your repository before something breaks and you lose your progress. If you have trouble understanding the following, go to the office hour and ask a tutor for help.

You ran into a merge conflict. A merge conflict happens when two persons A and B (or in this case, you on two different machines) edit the same line in a file.

git cannot decide which of the two changes are the correct ones, so it will mark the respective lines that have been changed by both parties with conflict markers and tells you to merge the conflicting lines yourself. This looks as follows:

Something before the conflict
<<<<<<< HEAD
I have been changed by person A
=======
I have been changed by person B
>>>>>>> origin/master
Something after the conflict

The line(s) above === corrspond to your change, the line(s) below are the changes of the other person.
To resolve the merge conflict, you need to replace the content enclosed in the conflict markers (`>>> and <<<, including the conflict markers themselves) with the content that is supposed to go there. If you think your change was right:

Something before the conflict
I have been changed by person A
Something after the conflict

If you think the other change is the right one:

Something before the conflict
I have been changed by person B
Something after the conflict

You can also choose both lines:

Something before the conflict
I have been changed by person A
I have been changed by person B
Something after the conflict

Or you could even place anything you want in place of the conflict, you get the idea.

After that, you simply git add and git commit both files to complete the merge. This will introduce a new commit that is the merge of the commits A and B.

5 Likes

i fixed it, thank you for your help