Git Experiences

Russell Bateman
last update:

Here I experience trying to update a very stale bit of code probably touched last on another piece of hardware and only copied from there.

russ@tirion ~/dev/hapi-fhir $ gs
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged ..." to unstage)
	new file:   src/test/java/com/windofkeltia/hapi/fhir/FhirDateTimeTest.java

Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git restore ..." to discard changes in working directory)
	modified:   .idea/inspectionProfiles/Project_Default.xml
	modified:   src/test/java/com/windofkeltia/hapi/fhir/FhirDateTimeTest.java

russ@tirion ~/dev/hapi-fhir $ git add src/test/java/com/windofkeltia/hapi/fhir/FhirDateTimeTest.java .idea/inspectionProfiles/Project_Default.xml
russ@tirion ~/dev/hapi-fhir $ gs
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged ..." to unstage)
	modified:   .idea/inspectionProfiles/Project_Default.xml
	new file:   src/test/java/com/windofkeltia/hapi/fhir/FhirDateTimeTest.java

russ@tirion ~/dev/hapi-fhir $ git commit -m "Added FHIR date, time and instance resource validation examples."
[master 91d9138] Added FHIR date, time and instance resource validation examples.
 2 files changed, 104 insertions(+)
 create mode 100644 src/test/java/com/windofkeltia/hapi/fhir/FhirDateTimeTest.java
russ@tirion ~/dev/hapi-fhir $ git push
To bitbucket.org:russellbateman/hapi-fhir.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'bitbucket.org:russellbateman/hapi-fhir.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
russ@tirion ~/dev/hapi-fhir $ git pull
remote: Enumerating objects: 76, done.
remote: Counting objects: 100% (76/76), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 61 (delta 44), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (61/61), 7.32 KiB | 535.00 KiB/s, done.
From bitbucket.org:russellbateman/hapi-fhir
   905bd9b..9e57188  master     -> origin/master
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.
russ@tirion ~/dev/hapi-fhir $ git pull --ff-only
fatal: Not possible to fast-forward, aborting.
russ@tirion ~/dev/hapi-fhir $ git pull --rebase
Auto-merging .idea/inspectionProfiles/Project_Default.xml
CONFLICT (content): Merge conflict in .idea/inspectionProfiles/Project_Default.xml
error: could not apply 91d9138... Added FHIR date, time and instance resource validation examples.
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm ", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 91d9138... Added FHIR date, time and instance resource validation examples.
russ@tirion ~/dev/hapi-fhir $ git add .idea/inspectionProfiles/Project_Default.xml
russ@tirion ~/dev/hapi-fhir $ git rebase --continue
[detached HEAD b1524a7] Added FHIR date, time and instance resource validation examples.
 2 files changed, 107 insertions(+)
 create mode 100644 src/test/java/com/windofkeltia/hapi/fhir/FhirDateTimeTest.java
Successfully rebased and updated refs/heads/master.
russ@tirion ~/dev/hapi-fhir $ git push
Enumerating objects: 24, done.
Counting objects: 100% (24/24), done.
Delta compression using up to 16 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (13/13), 1.78 KiB | 1.78 MiB/s, done.
Total 13 (delta 4), reused 0 (delta 0), pack-reused 0
To bitbucket.org:russellbateman/hapi-fhir.git
   9e57188..b1524a7  master -> master
russ@tirion ~/dev/hapi-fhir $ git pull
Already up to date.