Using git to put a project into a repository
I have a new project in Eclipse in the directory ProjectDirectory which contains the src, lib, etc. folders. Note that this project has never before communicated with any repository.
I have a git repository https://github.com/myrepo/mygit.git with a username
user and a password
pass (note that this is fake info). In that repository, I currently have some files.
I want to do the following.
- Remove ALL the current contents in the git repository
- Add the new contents from my Eclipse project into this repository. This should result in no conflicts or no errors whatsoever, since I want to completely replace the current repository with these files.
With specific instructions, what set of commands in the terminal would I write to accomplish this?
One Solution collect form web for “Using git to put a project into a repository”
Its fully simple. First go into the directory in terminal where the eclipse project is.
To start putting this under version managment:
Then add the origin as the git repo ( copy your ssh read+write access from github, this you see when you are loggin in on github and navigates to the actual repositorys directory ):
git remote add origin <copied_adress_from_github>
So now in the last step you will need to overwrite forced the remote repo with:
git push -f origin master
You can start commiting, making branches etc… However if on the remote repo there was other branches you want to remove them with:
git push origin --delete <branch_name>