Reputation: 12851
My boss created an empty project on github. Meanwhile I was developing the app on my local machine without git. How can I now "assign" my local app with the project created on remote? (github)
I could pull the project from github in a different directory, copy my files into this directory and do a commit / push. But is there a better way without creating a new dir?
Upvotes: 3
Views: 82
Reputation: 4255
Just add the github-repository as a remote in your repository then you can push your work to github:
git remote add origin https://github.com/user/repo.git #setUp github as remote
git push origin # push your changes to github
If your work is not in a repository right now just init a new one and commit the changes
git init #in project folder
git commit -m 'initial commit'
#setUp remote with above code
#git push origin
Please note
Just adding the remote repo may not set master
as an upstream-brunch so you may have to use:
git push origin master
If you do not want to always have to use the branch name for pushing you can set your branches as upstream-branches with
git branch --set-upstream my_branch origin/my_branch
Afterwards git push origin
will work for all branches with an upstream
Upvotes: 5