Just when I thought I'd got the hang of the
git checkout -b newbranch - commit/commit/commit -
git checkout master -
git merge newbranch -
git rebase -i master -
git push workflow in
git, something blew up, and I can't see any reason for it.
Here's the general workflow, which has worked for me in the past:
# make sure I'm up
to date on master:
$
git checkout master
$
git pull # k, no conflicts
# start my new feature
$
git checkout -b FEATURE9 # master @ 2f93e34
Switched
to a new branch 'FEATURE9'
... work, commit, work, commit, work, commit...
$
git commit -a
$
git checkout master
$
git merge FEATURE9
$
git rebase -i master # squash some of the FEATURE9 ugliness
Ok so far; now what I expect
to see -- and normally do see -- is this:
$
git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing
to commit (working directory clean)
But instead, I only see "nothing
to commit (working directory clean)", no "Your branch is ahead of 'origin/master' by 1 commit.", and
git pull shows this weirdness:
$
git pull
From . # unexpected
* branch master -> FETCH_HEAD # unexpected
Already up-to-date. # expected
And
git branch -a -v shows this:
$
git branch -a -v
FEATURE9 3eaf059 started feature 9
* master 3eaf059 started feature 9
remotes/origin/HEAD -> origin/master
remotes/origin/master 2f93e34 some boring previous commit # should=3eaf059
git branch clearly shows that I'm currently on * master, and
git log clearly shows that master (local) is at 3eaf059, while remotes/origin/HEAD - remotes/origin/master is stuck back at the fork.
Ideally I'd like
to know the semantics of how I might have gotten into this, but I would settle for a way
to get my working copy tracking the remote master again & get the two back in sync without losing history. Thanks!
(Note: I re-cloned the repo in a new directory and manually re-applied the changes, and everything worked fine, but I don't want that
to be the standard workaround.)
Addendum: The title says "can't push", but there's no error message. I just get the "already up
to date" response even though
git branch -a -v shows that local master is ahead of /remotes/origin/master. Here's the output from
git pull and
git remote -v, respectively:
$
git pull
From .
* branch master -> FETCH_HEAD
Already up-to-date.
$
git remote -v
origin
[email protected]:proj.
git (fetch)
origin
[email protected]:proj.
git (push)
Addendum 2: It looks as if my local master is configured
to push
to the remote, but not
to pull from it. After doing for remote in '
git branch -r | grep -v master '; do
git checkout --track $remote ; done, here's what I have. It seems I just need
to get master pulling from remotes/origin/master again, no?
$
git remote show origin
* remote origin
Fetch URL:
[email protected]:proj.
git
Push URL:
[email protected]:proj.
git
HEAD branch: master
Remote branches:
experiment_f tracked
master tracked
Local branches configured for '
git pull':
experiment_f merges with remote experiment_f
Local refs configured for '
git push':
experiment_f pushes
to experiment_f (up
to date)
master pushes
to master (local out of date)