Skip to content
Michael Schenk edited this page Dec 11, 2016 · 7 revisions

What if I get ! [rejected] refs/notes/gtm-data -> refs/notes/gtm-data (non-fast-forward) when trying to git fetchgtm or git pushgtm?

You are getting this because at some point you git push but didn't also git pushgtm which pushes the gtm note data.

You can resolve this conflict by merging the notes.

git fetch origin refs/notes/gtm-data:refs/notes/origin/gtm-data
git notes --ref gtm-data merge -v origin/gtm-data

git pushgtm

If you always git fetchgtm and git pushgtm anytime you normally git fetch and git push you should be able to avoid merging.

Here's some additional information on StackOverflow

How can I automatically initialize gtm when initializing git?

Here's a Bash/ZSH function we use to automatically gtm init when initializing a new git repo with git init. This also reports gtm status when running git status.

function git {
  command git "$@"
  rc=$?
  if [ $rc -ne 0 ]; then
    return $rc
  fi
  case "$1" in
    init)
      output=$(gtm init)
      if [ $? -eq 0 ]; then
        echo "$output"
      fi
      ;;
    status)
      output=$(gtm status)
      if [ $? -eq 0 ]; then
        echo "$output"
      fi
      ;;
  esac
  return $rc
}

What happens when I use git stash?

Why does the timeline seem to report incorrect times?

Why does gtm status not always report the correct time?