On Fri, Jan 3, 2014 at 4:13 AM, Robert Muir <rcm...@gmail.com> wrote:
> It happens with 1.8 too. I'm not really concerned what the technical > explanation is (i'm sure someone will say: you are holding it wrong). > > one of the most important things about version control is being able > to track changes. if 'status' tells me my working directory is clean, > but then 'push' does something, that tells me its not ready for prime > time :) > > step 1: make a commit to branch A > > rmuir@beast:~/bogus$ git checkout master > Switched to branch 'master' > rmuir@beast:~/bogus$ ls > foo > rmuir@beast:~/bogus$ touch bar > rmuir@beast:~/bogus$ git add bar > rmuir@beast:~/bogus$ git commit -m "blahblah" > [master 1463733] blahblah > 1 file changed, 0 insertions(+), 0 deletions(-) > create mode 100644 bar > rmuir@beast:~/bogus$ git push origin master > Counting objects: 3, done. > Delta compression using up to 8 threads. > Compressing objects: 100% (2/2), done. > Writing objects: 100% (2/2), 241 bytes | 0 bytes/s, done. > Total 2 (delta 0), reused 0 (delta 0) > To g...@github.com:rmuir/bogus.git > 9f54f3b..1463733 master -> master > > > step 2: merge to branch B > rmuir@beast:~/bogus$ git checkout feature > Switched to branch 'feature' > rmuir@beast:~/bogus$ git merge master > Updating 9f54f3b..1463733 > Fast-forward > bar | 0 > 1 file changed, 0 insertions(+), 0 deletions(-) > create mode 100644 bar > rmuir@beast:~/bogus$ git status > # On branch feature > nothing to commit, working directory clean > > ^^^^^^^ see that shit? it says the words 'working directory clean' but it > lies. > > rmuir@beast:~/bogus$ git push origin feature > Total 0 (delta 0), reused 0 (delta 0) > To g...@github.com:rmuir/bogus.git > 9f54f3b..1463733 feature -> feature > rmuir@beast:~/bogus$ git --version > git version 1.8.3.2 > > I believe this is because they are not remote tracking branches. So git does not seem them connected to the remote branch, This is also why you have to explicitly tell it the branch name when pushing If they are tracking branches git status will say things like: % git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working directory clean You need to use -t with git checkout: "git checkout -t -b feature origin/feature" or like branch --set-upstream