I have created an alias for catching up my tracking branches as needed. Here's the current line from the [alias]
section of my .gitconfig:
catchup = !CURRENTBRANCH=$(git symbolic-ref --short HEAD) && echo Currently on $CURRENTBRANCH - switching to $1 && git checkout $1 && git merge origin/$1 && echo Going back to $CURRENTBRANCH && git checkout "$CURRENTBRANCH"
I use it as follows (for example):
git catchup new_design
This code results in (for example):
Currently on integration
Switched to branch 'new_design'
Your branch is behind 'origin/new_design' by 1 commit, and can be fast-forwarded.
Updating c82f7db..51eea8a
Fast-forward
themes/theme1/css/styles.less | 17 +++++++++++++++++
themes/theme1/js/app.js | 6 +++---
2 files changed, 20 insertions(+), 3 deletions(-)
Going back to integration
error: pathspec 'new_design' did not match any file(s) known to git.
I have tried the last command in the alias both with and without the double-quotes, with the same result.
Anyone know how to resolve that error at the end?
For those who might suggest using git pull
, it doesn't resolve my problem, and would require entering my password. This alias is to be used if I have recently used git fetch
, and have no need to go back to the remote repo.
I am running git bash on Windows 7, fyi.