Skip to content

Commit 3a4c5f2

Browse files
committed
proper way to get the current branch, without empty lines
1 parent 9f5c973 commit 3a4c5f2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: git-remote-in-sync.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ done
5757

5858
# added/deleted/modified files in the currently checked out branch or index.
5959
# this should do I think. (other branch, esp remote tracking branch should not be checked, right? maybe if this one is dirty..)
60-
cur_branch=`git branch | cut -d ' ' -f2`
60+
cur_branch=`git branch | grep '^\* ' | cut -d ' ' -f2`
61+
cur_branch=${cur_branch// /}
6162
exp="# On branch $cur_branch
6263
nothing to commit (working directory clean)"
6364
out=`git status`

0 commit comments

Comments
 (0)