Reputation: 33
I have remote repository which contains, some packages, and stuff basically content of package. So I want to refactor it and make new project containing some stuff from existing one. So I create new maven project to my workspace where I already imported my repository. So I add some stuff to new package and i want to push it to my remote repository. Could anyone give me a tip, or some help, I am basic eclipse user.
But when I try to share it using same local repository, then I have two projects to import but one is inside the other which I dont want. If i try to delete inner one, then project deletes.
I want my tree to look like
-.git
-proj1
-proj2
and not like
-.git
-src
-proj2
-pom.xml
-etc..
Upvotes: 0
Views: 52
Reputation: 1013
Git manages its local operations on your system using the .git
directory it creates when a project initiates git to be used. Whenever you make any changes in your project, the .git
folder helps the git
cli to know the status of the project and lets you perform git operations like diff, pull, push, etc.
If you move this .git
folder to an empty folder, Git will interpret that you have deleted all the files from your changes. If you move it to a folder with different files, Git will again think that you have deleted the older content in your project folder and added new stuff in it i.e. Git never knows that you moved your .git
folder.
Hence, you can use the above logic to achieve the same. Follow the steps below:
.git
folder in it from the project folder. Your new root folder will contain .git
folder only..git
and proj1
..git
, proj1
and proj2
.git add .
, git commit -m 'your message'
and finally git push
Your done.
Upvotes: 1