Some useful git commands which for working with and on jx

Auto signing commits

Per repo:

> git config commit.gpgsign true

See also is-there-a-way-to-autosign-commits-in-git-with-a-gpg-key

GPG sign commits on a branch

All commits for the jenkins-x/jx repo needs to be signed-off which per default adds the Signed-off-by line to the commit message including your email.

Members of the GiuHub jenkins-x organisation can alternatively to signing off a commit, cryptographically sign the commits. See also GitHub’s help page on this topic. To sign a single commit you specify the -S option:

> git commit -S

In case you missed to sign a commit as part of a pull request:

> git rebase --exec 'git commit --amend --no-edit -n -S' -i master

Aligning lables across repositores

> npm install -g copy-github-labels-cli
> copy-github-labels -t <token> <source-repo> <destination-repo>

where token is your GitHub API token.

Git filter-branch

> git filter-branch --tree-filter 'rm -rf <file-dir-to-delete>' --prune-empty HEAD

Pull tags as part of git pull

$ git config remote.<remote>.tagOpt --tags

Show sha of the current refs

$ git show-ref --head --dereference

Show sha of the current refs

$ git show-ref --head --dereference

Find merge commits with manual changes

$ git log -p --cc --min-parents=2

Find sha for tag

$ git rev-list -n 1 $TAG