beepboop
beepboop

Reputation: 65

git push not working - says everything is up to date, when clearly not

I'm working on a project, where I have 4 branches, but I'm focused on one branch at the moment. I'm not sure what happened but I've made changes to my code, and tried to commit and push, however Git is telling me that "Everything up-to-date" when clearly it's not as there are modified files that I've staged and tried to commit.

I've looked at these links Fix a detached head, git push says "everything up-to-date" even though i have local changes where I could possibly be in a detached HEAD however, to be completely honest, I'm not sure how to know this.

Here is the output of git branch -a and git status:

codio@senior-miranda:~/workspace$ git branch -a
  bug-remove-logged-msg-01
  home-page
  master
  selling-items
* styling
  stylingchanges
  remotes/origin/home-page
  remotes/origin/master
  remotes/origin/remove-loggedin-message
  remotes/origin/selling-items
  remotes/origin/styling
codio@senior-miranda:~/workspace$ git status
On branch styling
Your branch is up to date with 'origin/styling'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   views/register.handlebars

codio@senior-miranda:~/workspace$ git commit -m "viewport meta"
PRE-COMMIT
codio@senior-miranda:~/workspace$ git push
Everything up-to-date
Everything up-to-date

The PRE-COMMIT hook runs ESLint and if any errors arise, prevents the commit from happening. After checking, I can confirm the PRE-COMMIT exits with a value of 0.

Output of git log --oneline --graph -5:

codio@senior-miranda:~/workspace$ git log --oneline --graph -5
* a5198f5 (HEAD -> styling, origin/styling, origin/selling-items, stylingchanges, selling-items) added prefers colour scheme css
* fb44eec linter new line
* 5aa511f responsive cards on home
* 65d0765 (master) linter newline
* daedd13 working on theme changer + navbar improvements

Upvotes: 0

Views: 222

Answers (3)

beepboop
beepboop

Reputation: 65

The issue in the end I believe was the pre-commit hook, which is really strange as it's exiting with a value of 0, nevertheless thanks everyone for the help.

Renaming the hook back to a sample (pre-commit.sample) fixed my issue.

Upvotes: 1

LeGEC
LeGEC

Reputation: 51850

Have you checked your git status after committing ?

Have you checked your local history, (in a terminal : git log --oneline --graph, or an overview in any graphical frontend)
in particular what is your local branch state with respect to its remote counterpart ?


The output of your git commit command indicates that you have a pre-commit hook (one that at least prints PRE-COMMIT on your terminal), do you know what this hook does ?

If this hook exits with an error code, the commit will simply be rejected, and git does it silently (it relies on the hook printing explanations on why the commit was rejected).

Upvotes: 0

Patricia
Patricia

Reputation: 2865

Did you add your files before? git add -A and then commit

Upvotes: 0

Related Questions