So I set up a new computer recently (Mac M1), downloaded / setup vscode and am now having trouble with a repo I'm working on.
My goal is just to be able to push to the repository on github when changes are made. However I've been running into a problem where when I try to commit, my terminal outputs that my branch is up to date.
I first realized the problem when I tried to committing a change in the code to the github repo (first running git add .
and then running git commit -m "..."
. While it had worked previously (such as when initializing the repository), this time there was a message:
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
The changes however were not on the github repository.
What did I try:
One post mentioned it might be that my "local branch doesn't know about the remote branch" and to run git branch --set-upstream-to origin/master
(or in my case git branch --set-upstream-to origin/main
). After running that, the output was branch 'main' set up to track 'origin/main'.
but when I tried to run git commit -m "..."
again I still got the same output as before about my branch being up to date (despite this not being the case).
Another post suggested to try to make a new repo and push the existing code. I tried a few variations of this
- Running
m -rf .git/
and then initializing the repo in the same folder but pushing to the same 2. Deleting the folder and cloning a new one from github and then making a new commit - Initializing a new github repo and pushing the code. While the first commit worked for each of these ways, following commits returned the same output as the initial problem.
This article suggested to run git remote add origin https://github.com/.../...
but resulted in the same output for me after running and trying to commit the changes.
Another article suggested my "local copy... may or may not be up-to-date with your origin remote" and to run git fetch
but after running git status
again, it outputted that everything was up to date.
Most other articles and posts were some variation of these and the ones that weren't I tried my best to follow but didn't see any changes.
What was I expecting:
I was expecting for there to be changes to commit and that when I pushed, the github repository would reflect those changes.