Add project to existing repo
Sometimes you want to add an existing project into a Git repo. You've been working on something for a while and want to make it into a repo, or I find this helpful after creating a project with a command line tool like Ionic or Meteor. These tools create a new directory and populated it like template.
Either way you might have previously created your repos first and never come across this problem. It's quite easy to resolve with this:
cd <project dir>
git init
git add -A
git commit -m 'first commit'
git remote add origin <your repo address here>
git pull origin master
git push origin master
Breaking it down:
If you project never belong to a repo it needs a git file.
git init
Add all your project files.
git add -A
Name your first commit.
git commit -m 'first commit'
This is where you connect your project to your remote repo.
git remote add origin <your repo address here>
Before pushing you may need to pull any changes down.
git pull origin master
Push your first commit.
git push origin master
Written by Jason McIver
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#