2

I am very confused at the moment about my branch's staging.

I am on a branch called lazy-load

Git status shows:

nothing to commit, working directory clean

git diff and git diff --cached show nothing.

But if I push to origin lazy-load, a large number of files are pushed, almost the entire repo, including files deleted from the repo previously.

Where am I wrong? I've tried git rm --cached and git reset HEAD.

I can't seem to unstage files or even see staged files on the branch.

Mouloud85
  • 3,826
  • 5
  • 22
  • 42
Union find
  • 7,759
  • 13
  • 60
  • 111
  • 2
    try `git reset --hard ` to reset your HEAD pointer to a previous commit and discard all changes since then, rm --cached doesn't unstage a file. It stages the removal of the file from the repo and leaves the file in your working tree, leaving you with an untracked file. http://stackoverflow.com/questions/6919121/why-are-there-2-ways-to-unstage-a-file-in-git – chrismillah Apr 24 '15 at 00:33
  • With the above comment I was able to fix the problem. – Union find Apr 24 '15 at 00:36

2 Answers2

4

Try git reset --hard <commit> to reset your HEAD pointer to a previous commit and discard all changes since then, git rm --cached doesn't unstage a file - it stages the removal of the file from the repo and leaves the file in your working tree, leaving you with an untracked file. *

git cheat sheet

*related post

Community
  • 1
  • 1
chrismillah
  • 3,704
  • 2
  • 14
  • 20
2

git status will only show you uncommitted changed, as will git diff. It may show you how many commit differences you have between your branch and the remote equivalent, unless you haven't got fast forwarding set up.

To compare with the remote version of your branch you should do a fetch and comparison with the remote to see what you're actually pushing up:

git fetch --all
git diff [branch] origin/[branch]
scrowler
  • 24,273
  • 9
  • 60
  • 92