I have just waded into the GIT pool using GitHub. I have successfully created a repo on GITHub through computer "A" using an old- but completely working- version of my project.
On a different computer (computer "B") I have been tinkering and changing a lot of things. This comptuter is not connected to GitHub yet. I'm wondering what the best practice would be to get everything correct.
Do I manually move my files on computer "B" out of the folder git is intialized in, pull what's on GitHub, and then copy the files back into the folder so that git recognizes the changes and then I can push a new branch?
Thanks for your help!!
CodePudding user response:
On computer B, in the project folder, initialize Git and set up GitHub as the remote. Make a branch and add everything to it and commit. Now fetch, and checkout main (or whatever branch holds the stuff from computer A). Merge your branch, allowing unrelated histories, and push.
cd ...
git init
git remote add origin ...
git switch -c mybranch
git add .
git commit -m 'stuff from computer B'
git fetch
git switch main
git merge --allow mybranch
git push origin main