Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)

I'm trying to update a Git repository on GitHub. I made a bunch of changes, added them, committed then attempted to do a git push. The response tells me that everything is up to date, but clearly it's not.

git remote show origin

responds with the repository I'd expect.

Why is Git telling me the repository is up to date when there are local commits that aren't visible on the repository?

  [searchgraph]  git status

# On branch develop

# Untracked files:

#   (use "git add <file>..." to include in what will be committed)

#       Capfile

#       config/deploy.rb

nothing added to commit but untracked files present (use "git add" to track)

  [searchgraph]  git add .

  [searchgraph]  git status

# On branch develop

# Changes to be committed:

#   (use "git reset HEAD <file>..." to unstage)


#       new file:   Capfile

#       new file:   config/deploy.rb


  [searchgraph]  git commit -m "Added Capistrano deployment"

[develop 12e8af7] Added Capistrano deployment

 2 files changed, 26 insertions(+), 0 deletions(-)

 create mode 100644 Capfile

 create mode 100644 config/deploy.rb

  [searchgraph]  git push

Everything up-to-date

  [searchgraph]  git status

# On branch develop

nothing to commit (working directory clean)

1 Answer

0 votes
by (41.4k points)
edited by

This happened to me when my SourceTree application crashed during staging. And on the command line, it looks like the previous git add is corrupted. If this is the case, try:

git init

git add -A

git commit -m 'Fix bad repo'

git push

Check out this Git Tutorial to know more.

Browse Categories