Saturday, January 23, 2021

Git: Updates were rejected because a pushed branch tip is behind its remote counterpart

 

>PROBLEM


Git push fails returning "Updates were rejected because a pushed branch tip is behind its remote counterpart...".


 ! [rejected]        master -> master (non-fast-forward)

error: failed to push some refs to .. SOME DIR PATH

hint: Updates were rejected because a pushed branch tip is behind its remote

hint: counterpart. Check out this branch and 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.



>SOLUTION


Following the hint suggested in the output:

  git push --help


The --force option solves:

  git push --force origin master

  

Because it was behind the counterpart, it may cause some side effect on log.

When performed the command, everything was fine, no issues, but another client had to push with --force flag too, but no further issues.



>ENV

Windows 10

Git version 2.19.1.windows.1


Tuesday, January 19, 2021

Slow Machine? Warn Up - Check this before it is too late


 >PROBLEM


Defragmentation is OK, there is no strange process taking the CPU for itself, no virus, but the desktop or notebook is very slow, much more than usual and, it seems that it get worse every month.

Also, you have noticed that the system requires HD fixes, leading to scans to fix block references, more frequently than usual.


>SOLUTION


"Your HD, in this case is very fond of you!"  :-)

It probably has been trying to warn you that it is supposed to end its life soon.

Time to make backup of all your stuff to an external HD or to make a revision of your data's backup routines to make sure everything is up to date.

Consider making a clone of your HD to be used when the current one is dead, or to replace it.

There are good apps for this, free or paid:

Free: HD Clone, Disk Genius
Paid: DriveClone, EaseUS Partition Master

TIP

If you have a big number of files, not qualitatively but quantitatively, not big files in size but numerous files, this condition stress the HD. That way, if the HD is old, having many hours of intense activities (working during the day and scheduled backups during the night), bad blocks are generated more frequently, leading to the required scans asked by the system.

If you have split your HD into two partitions, for instance, "C:" for Windows and "D:" for data, you get a better chance to solve this issue and gain more time until the HD replacement by moving your data on "D:" partition to another disk and deleting D:.
In this case, the HD will be less required and the issue may slow down, giving you an extra time before the HD substitution, something that may save you time, money and opportunity.

I've solved recently an issue like this just deleting the data partition. The HD got half work to do, so the situation became bearable. On the remaining free space, I cloned the "C:", getting to "C:" partitions on the same disk, but one of them disable at a time. If the HD's initial boot is preserved, when the active "C:" partition is gone, you may switch to the other just activating it. After you finish your work, you may clone the active "C:" partition to replace the defective one.
This saved me many hours during an urgent work that I couldn't stop for long maintenance and enabled me to deliver the task on time.

Always consider using different partitions for the system and the data, even if working with other S.O. different of Windows.





>ENV

Windows 10

Git rebase fails to continue

 

>PROBLEM


You perform "git rebase":
git pull --rebase

And returns:

First, rewinding head to replay your work on top of it...
Applying: room1 branch by room1
.git/rebase-apply/patch:23: new blank line at EOF.
+
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M       about.diff
Falling back to patching base and 3-way merge...
Auto-merging about.diff
CONFLICT (content): Merge conflict in about.diff
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 room1 branch by room1
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

Next, you solve the conflict.
Details here

After, you try to continue the rebase, but the git refuses still requiring merging.


>SOLUTION

If the conflict was already solved, you may use skip option, as shown in the message above returned by git:
git rebase --skip

If you've performed this operation over master branch, may have consequences as information loss.

Check details here.


>ENV

Windows 10

Monday, January 18, 2021

git: 'credential-cache' is not a git command. See 'git --help'.

 

>PROBLEM


git: 'credential-cache' is not a git command. See 'git --help'.


>SOLUTION


Edit .git\config fille and remove:


[credential]

helper = cache







>ENV

Windows 10


eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...