Git status says "up to date with origin/master" after changes, but this is not the case

I recognize that this seems like a beginner issue, but posting here is my last resort: I’ve tried numerous solutions online, and nothing seems to work.

Clearly, something is off with branches. When I create changes to my repo on the browser, I can pull the changes in Mac terminal no problem.

However, when I make changes in the Terminal, adding/committing/pushing does not work. Git status gives me the message:

On branch master

Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

I’ve tried lots of methods online for resolving this, including: git checkout HEAD, git fetch --all \ git reset --hard origin/master, git branch --set-upstream-to origin/master

None of these have resolved the problem for me. I would be very grateful for any help that someone could provide, and I will try to respond quickly in case you are wondering what the output of different commands are on my local config.

Thanks so much!

Exactly how do they “not work”? Are you getting error messages? If so, please quote those, for each step, together with the exact command you are using.

Please be very careful trying random commands, at least one in that list is extremely destructive: git reset --hard origin/master sets your current branch to the state of origin/master and discards all local changes, including those already committed (!) to your current branch. You may be able to salvage such orphaned commits if you do it soon, before they are garbage collected.

Thanks for the reply.

I just cloned the repo, and I don’t have any meaningful local changes.

When I say the changes don’t work, what I mean is when I make changes, I get the message I copied above (aka the changes are not committing/being added to working tree(?)

For example, I could do mkdir hi then git status will yield above message.

Ah, I see. First off, git won’t track empty directories, so that hi/ directory not showing up is fine. What happens if you create a file, or modify one that’s in the repository? Does git show mention that? If not, also look for a .gitignore file, if there is one. If your file matches any of the patterns in there it will be ignored.

For terms, “working tree” refers to the files you can, well, work on. New or edited files (or parts of them) on the working tree may then be added to the “index”, and committed.

2 Likes

Wow, do I feel dumb…

I was creating empty directories to check whether git was tracking changes. Just tried creating a file and everything worked.

Thanks so much for the help!!

1 Like