git is doing my head in.  I started using it thinking it would help but it 
just seems to add extra time and headache to projects that wasn't there 
before.  Almost every time I try to update a repo, I get an error that 
confueses the hell out of me... I have come to the conclusion that I am 
clearly too stupid to use git but thought I would post here before writing 
it off forever.

All I know of git is what I've learnt on YouTube videos.

Today I added 5-6 files that I had edited into the master branch

git add .

Then I committed and pushed to origin

git commit -m 'Updates...'

[master 0cc8698] Updates...
 7 files changed, 673 insertions(+), 334 deletions(-)
 create mode 100644 classes/class.email.php

git push origin master

Counting objects: 12, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 3.54 KiB | 0 bytes/s, done.
Total 12 (delta 10), reused 0 (delta 0)
To https://gitlab.com/SJWGL/project.git
   9837efd..0cc8698  master -> master

Then, as I was closing all the files, I noticed some comments I had left in 
a couple of files and wanted to just clean up which I did.

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   api/process.booking.php
        modified:   classes/class.logger.php
        modified:   configuration.php

no changes added to commit (use "git add" and/or "git commit -a")



I then tried to add the small changes to the previous commit as they dont 
need their own commit.

$ git add .

$ git commit --amend
[master 54c1612] Updates...
 Date: Tue May 5 10:16:30 2020 +1000
 9 files changed, 681 insertions(+), 340 deletions(-)
 create mode 100644 classes/class.email.php

$ git push origin master
To https://gitlab.com/SJWGL/project.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitlab.com/SJWGL/project.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


So I follow the instructions:

$ git pull origin master
>From https://gitlab.com/SJWGL/project
 * branch            master     -> FETCH_HEAD
Auto-merging api/process.booking.php
CONFLICT (content): Merge conflict in api/process.booking.php
Automatic merge failed; fix conflicts and then commit the result.


Then I fumble my way through just to try and get the file into repo but 
obviously there is a problem that I dont know how to manage...

$ git diff
diff --cc api/process.booking.php
index efd3e11,9e9eed8..0000000
--- a/api/process.booking.php
+++ b/api/process.booking.php
@@@ -79,7 -79,6 +79,10 @@@ else


  endif;


++<<<<<<< HEAD
 +// If no errors, send email
++=======
++>>>>>>> 0cc8698b634303b68e8a8568af503ed7576e3cc2
  if ($sendEmail) {
        $email = new Email();
        $email->setBookingData($booking->getBookingData());

$ git push origin master
To https://gitlab.com/SJWGL/project.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitlab.com/SJWGL/project.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

$ git status
On branch master
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths:
  (use "git add <file>..." to mark resolution)

        both modified:   api/process.booking.php

no changes added to commit (use "git add" and/or "git commit -a")

$ git add .

$ git commit --amend
fatal: You are in the middle of a merge -- cannot amend.

$ git commit
[master a32b8a9] Merge branch 'master' of https://gitlab.com/SJWGL/project

$ git push origin master
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1.20 KiB | 0 bytes/s, done.
Total 11 (delta 9), reused 0 (delta 0)
To https://gitlab.com/SJWGL/project.git
   0cc8698..a32b8a9  master -> master


I dont know that the f**k I'm doing???

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/13182e6f-3328-491a-aa44-1da01ff29cc2%40googlegroups.com.

Reply via email to