few months ago I moved a project from one server to the other. I just noticed that the .git folder disappeared.
I want to connect that folder back again to the remote repo on GitHub. I tried to follow this solution, but it doesn't work in my case.
I created a new git init
.
The I run git remote add origin https://github.com/myusername/theRepo
Then if I run git status I get all the files I have in red as Untracked files: :
git status
On branch master
No commits yet
Untracked files:
...........
Then I run: git fetch --all
Fetching origin
Username for 'https://github.com': myusername
Password for 'https://myusername@github.com':
remote: Enumerating objects: 171, done.
remote: Counting objects: 100% (171/171), done.
remote: Compressing objects: 100% (111/111), done.
remote: Total 171 (delta 39), reused 162 (delta 30), pack-reused 0
Receiving objects: 100% (171/171), 3.98 MiB | 2.61 MiB/s, done.
Resolving deltas: 100% (39/39), done.
From https://github.com/myusername/myRepo
* [new branch] master -> origin/master
then I run git branch
and there is no output.
git status
still says all my files are untracked.
In these months few of my local files are newer than the repo. Were edited locally (it's a wordpress theme).
How can I make it to see only the files that are different be in red so that I can push to the repo only the files that are really different?
Or maybe it's better to create locally a new branch, push everything to the new branch, and then compare the two branches in github and in case of need -> merge?
Either way, can anyone please help to make it happen?
If I run git checkout master
:
git checkout master
error: The following untracked working tree files would be overwritten by checkout:
and here the big list of files (all files)
then if I run again:
git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)