changing git ssl to git https

git config –global –unset http.proxy

git config –global credential.helper “cache –timeout=36000”

git config –global credential.helper wincred

git remote -v

git remote set-url origin https://gitlab.server.com/prj/module.git

git pull

fatal: unable to access ‘https://gitlab.server.com/prj/module.git/’: SSL certificate problem: unable to get local issuer certificate

git config –global http.sslVerify false

Username for ‘https://gitlab.server.com’: username
Password for ‘https://username@gitlab.server.com’:
Already up-to-date.

Optional or orElse

What’s more elegant

Optional<Header> resultcode = Arrays.stream(response.getAllHeaders())
        .filter(h -> "X-Header-Result".equals(h.getName()))
        .findFirst();

return resultcode.isPresent() ? resultcode.get().getValue() : "";

Or

String resultcode = Arrays.stream(response.getAllHeaders())
        .filter(h -> "X-Header-Result".equals(h.getName()))
        .findFirst().map(NameValuePair::getValue)
        .orElse("");

return resultcode;

Inspect unknown Java objects at runtime

// debug purposes: to inspect unknown objects at runtime
static void inspect(Object obj) {
try {
for (Field f : obj.getClass().getDeclaredFields()) {
f.setAccessible(true);
System.out.printf("%s %s %s %s%n",
Modifier.toString(f.getModifiers()),
f.getType().getSimpleName(),
f.getName(),
f.get(obj)
);
if ("Object[]".equals(f.getType().getSimpleName())) {
LOG.warn("further inspect object " + f.get(obj));
}
if ("int".equals(f.getType().getSimpleName())) {
LOG.warn("expected size " + f.get(obj));
}
if ("List".equals(f.getType().getSimpleName())) {
List<Object> objects = (List<Object>)(List<?>) f.get(obj);
for (Object o : objects) {
inspect(o);
}
}
}
} catch (IllegalAccessException iae) {
System.out.println("IllegalAccessException : " + iae.getMessage());
}
}

remove last git push

Show last commit comment first:
git log –name-status HEAD^..HEAD

Then, remove the last commit and push:
git reset –hard HEAD~1

See also: https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History