Last active
August 1, 2020 01:25
-
-
Save mike1011/e490871f3150cf6bef8215ac74ff8667 to your computer and use it in GitHub Desktop.
Push existing code to new fresh repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To begin with, firstly create a new repository on github WITHOUT INITIALIZING it. | |
## clean up existing repo | |
rm -rf .git | |
## re-initialize it with new .git settings | |
git init | |
## firstly, dont commit any code, just create/add new sample/readme file and push it to new repo/master | |
git add README.md | |
## add newly created fresh repo | |
git remote add origin [email protected]:username/my-new-master-repo.git | |
git commit -m "first commit" | |
git push -u origin master | |
## verify and then if its successful, push remaining files | |
git status | |
## get latest readme/sample file you pushed to get in sync with new master/repo | |
git pull origin master | |
## add all now | |
git add . | |
git commit -m "first project push" | |
git push origin master | |
----- Done ----- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment