Git Existing Code → New Remote Repo
- Local folder name = repo name
- Know:
- default branch (usually
main) - remote URL
- default branch (usually
Without local Git repo
Section titled “Without local Git repo”git initgit add .git commit -m "initial commit"git branch -M maingit remote add origin [GIT URL]git push -u origin mainWith local Git repo
Section titled “With local Git repo”git remote add origin [GIT URL]git branch -M maingit push -u origin mainBefore the first commit
Section titled “Before the first commit”Avoid committing:
- build folders
- system files
- generated files
- IDE settings
Use: https://github.com/github/gitignore
Additional Files
Section titled “Additional Files”License
Section titled “License”- Required for adoption
- Many companies only allow specific licenses
Basics to check:
- permissive vs copyleft
- compatibility
- permissions
Use: https://opensource.org/licenses
README
Section titled “README”- Short project description is enough to start
- Improve over time
Checklist
Section titled “Checklist”- Create an empty remote repository
- Match local folder name with repo
- Add
.gitignore - Choose a license (if OSS)
- Create a README
- Push the initial commit