Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push says everything up to date when it definitely is not

Tags:

git

push

I have a public repository. No one else has forked, pulled, or done anything else to it. I made some minor changes to one file, successfully committed them, and tried to push. It says 'Everything up-to-date'. There are no branches. I'm very, very new to git and I don't understand what on earth is going on.

git remote show origin tells me:

HEAD branch: master
  Remote branch:
    master tracked
  Local ref configured for 'git push':
    master pushes to master (up to date)

Any ideas what I can do to make this understand that it's NOT up to date?

Thanks

Updates: git status:

# On branch master
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#       histmarkup.el
#       vendor/yasnippet-0.6.1c/snippets/
no changes added to commit (use "git add" and/or "git commit -a")

git branch -a:

* master
  remotes/origin/master

git fsck:

dangling tree 105cb101ca1a4d2cbe1b5c73eb4a238e22cb4998
dangling tree 85bd0461f0fcb1618d46c8a80d3a4a7932de34bb

Update 2: I re-opened the modified file, and the modifications I KNOW I had made were gone. So I added them again, went through the rigamarole of git status, git add filename, git commit -m "(message)", and git push origin master, and all of a sudden it works the way it's supposed to.

Update 3: git reflog output:

009251 HEAD@{0}: commit: added copy/paste keybindings
06920f9 HEAD@{1}: commit: Minor .gitignore tweak
84aa30c HEAD@{2}: checkout: moving from master to master
84aa30c HEAD@{3}: checkout: moving from ec16cca979045547a5444e20f48ed468dee81dd4 to master
ec16cca HEAD@{4}: commit: Added keybindings for copy/paste
5c4a611 HEAD@{5}: commit: remember-mode keybinding to M-R
f3e4729 HEAD@{6}: commit: Correcting last push which wiped out some stuff
fa28a3e HEAD@{7}: checkout: moving from master to fa28a3ed80eb0c6d4375ae77060d5cb4143d6a8e^0
84aa30c HEAD@{8}: commit: Modified keybindings, added LaTeX hook
10e7718 HEAD@{9}: commit: Added a few keybindings
d62378b HEAD@{10}: commit (initial): first commit
like image 558
Wolf Avatar asked Jan 29 '11 14:01

Wolf


People also ask

Why does git say up-to-date when its not?

If the current branch is not outdated compared to the one you pull from, pull will say Already up-to-date. even if you have local changes in your working directory. git pull is concerned with branches, not the working tree — it will comment on the working tree only if there are changes which interfere with the merge.

Why is git push showing everything up-to-date?

If you attempt to do a normal git push origin master after adding a tag, you'll get an “Everything up-to-date” message from Git. In short, this is because you have to push a tag to the origin just like you push a branch.

Why is my git push not working?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

Does git push push everything?

By default, git push only updates the corresponding branch on the remote. So, if you are checked out to the main branch when you execute git push , then only the main branch will be updated. It's always a good idea to use git status to see what branch you are on before pushing to the remote.


2 Answers

Try

git config push.default tracking

http://git-scm.com/docs/git-config :

push.default

Defines the action git push should take if no refspec is given on the command line, no refspec is configured in the remote, and no refspec is implied by any of the options given on the command line. Possible values are:

* nothing - do not push anything.
* matching - push all matching branches. All branches having the same name in both ends are considered to be matching. This is the default.
* upstream - push the current branch to its upstream branch.
* tracking - deprecated synonym for upstream.
* current - push the current branch to a branch of the same name.
like image 104
John Avatar answered Sep 21 '22 16:09

John


EDIT: This it seems is not the correct solution, see the comments to the question. I am leaving the answer because the git add rather than git commit -a hint might help someone in the future.

Hello, did you add before you commited? something like

git add .

(don't forget the dot)

before the

git commit -m "what you changed"

(I find this site useful for getting going - http://gitref.org/remotes/#push)

like image 26
Tom Avatar answered Sep 19 '22 16:09

Tom