I have a Git repository and a local directory copied from it that is not a repository. The directory diverged from the repository awhile ago.
I want to:
- Make it a repository.
- Link it to the remote repository.
- See what changed and selectively commit local files and push them to the remote.
Essentially it is the same as cloning the remote and copying my directory over it.
Is there a graceful way without copying? I cannot copy because the local directory is large, and I would have exceeded quota.
I have found many answers like this: https://stackoverflow.com/a/45577839/11382675
git init
git add --all
git commit -m 'Add files'
git remote add origin https://...
git fetch origin
git diff origin/master
The difference is that I want to keep the new local files untracked, and so I cannot commit them.
I also attempted to do the following:
- Cloned the repository.
- Copied the
.git
from it into the directory.
But when I do git add -i
I get all the files listed as unchanged:
...
16993: unchanged +0/-0 shared/PHPMailer/language/phpmailer.lang-sk.php
16994: unchanged +0/-0 shared/PHPMailer/language/phpmailer.lang-sr.php
16995: unchanged +0/-0 shared/PHPMailer/language/phpmailer.lang-tr.php
16996: unchanged +0/-0 shared/PHPMailer/language/phpmailer.lang-uk.php
16997: unchanged +0/-0 shared/PHPMailer/language/phpmailer.lang-vi.php
...
Since we are here I wonder why I get this output?