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:
pull # k, no conflicts
# start my new feature
checkout -b FEATURE9 # master @ 2f93e34
Switched to a new branch 'FEATURE9'
... work, commit, work, commit, work, commit...
rebase -i master # squash some of the FEATURE9 ugliness
Ok so far; now what I expect to see -- and normally do see -- is this:
# 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:
From . # unexpected
* branch master -> FETCH_HEAD # unexpected
Already up-to-date. # expected
branch -a -v shows this:
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
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:
* branch master -> FETCH_HEAD
origin [email protected]
origin [email protected]
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?
remote show origin
* remote origin
Fetch URL: [email protected]
Push URL: [email protected]
HEAD branch: master
Local branches configured for 'git
experiment_f merges with remote experiment_f
Local refs configured for 'git
experiment_f pushes to experiment_f (up to date)
master pushes to master (local out of date)