I have a spring application in ClearCase repo currently with 3 folders architecture such as util, web and EAR but I need to migrate it to Git.
So how this architecture to be maintained with gradle, as I don't want to change my code
If your current working tree is working with graddle, simply import it in a new git repo from your snapshot view:
cd /path/to/snapshot/view
git init .
touch .gitignore
Add the files/folder you don't need in a git repo.
See for instance Gradle.gitignore
git add .
git commit -m "My first commit"
That won't import the full history (you still can see it through ClearCase), but you will then be able to push that git repo to a remote one, and start working with Git from there.
Related
I've GitHub repository in my IIB10 toolkit using EGit plugin.
I used to work with that repository.
I took workspace project interchange(PI) backup, later some changes my project has crashed.
So, I just imported my project from the PI backup and it got disconnected from GitHub.
I am using the same project in the different workspace, there also this project has deleted.
Now I have that project in the local workspace(not local git). How can I resolve this one? Please help me out.
If your workspace has no .git subfolder, you should at least:
clone your original GitHub repository
import your restored backup back to the new local clone
That is:
cd /path/to/restored/repo
cd ..
git clone https://github.com/<me>/<myrepo>
cd myrepo
git --work-tree=../repo add .
git commit -m "import from backup"
git push
How to import a specific project from github ? I dont want to clone the entire repository
I just want to clone only a portion of repository .
For eg this url https://github.com/eugenp/tutorials
has many projects but I just want to clone only spring-boot-crud project .
Here is the url for spring-boot-crud project.
https://github.com/eugenp/tutorials/tree/master/spring-boot-modules/spring-boot-crud
Thank you .
You can look into a git sparse-checkout: that command is made to checkout only part of a Git repository. This assume the latest Git 2.26 though.
And I mean Git-core, as in Git SCM, not Egit (which does not support the new sparse-checkout command)
Even though the command is new and still experimental, it should be useful in your case.
git clone --no-checkout /url/a/repo
cd repo
git sparse-checkout init --cone
git sparse-checkout set spring-boot-modules/spring-boot-crud
Then open the relevant project in your Eclipse.
Create a project in the Git repo (.project, in the root folder of your repo)
That will give you:
git clone -n https://github/git/git git2
cd git2
git sparse-checkout init
git sparse-checkout set Documentation
At this point, you have the repository git/git with only the folder Documentation checked out (everything else is not in the working tree)
# create an empty project in C:\path\to\git2 in Eclipse
As you can see, all the other files not checked out are not displayed in the Git staging view. Only the ones currently checked out and modified are listed.
The first step must be done in command-line because JGit does not support the sparse-checkout directive (see but 383772 and change 33)
I have a problem with my project in Eclipse IDE.
For the first time, I worked on an old version and made several changes.
I tried to upload the project on GitLab for the first time I configured Git on Eclipse IDE and I tried to commit and push "but I could do that only after doing a 'Fetch' from the remote branch and commit the 'Merge' change in my local repository.
Because I got this error:
rejected non-fast-forward
I followed this link Egit rejected non-fast-forward to fix it.
The fetch downloaded all the git project files in my project on Eclipse. Until now in my project, I have a subfolder like this: myProject/myProject.
I made several commits and push and it works normally. I figured out that a subdirectory in gitLab docroot is created with every push I make.
This is the local project structure:
This is the project structure on GitLab:
I want to delete docroot/WEB-INF/classes from GitLab.
How to delete this commit from GitLab using git plugin in Eclipse and how to correct my local project structure?
docroot/WEB-INF/classes is a folder. Git does not track folders, only files:
To delete a folder, you have to delete all the files in it.
In the Git Staging view, commit the deletions.
Make sure your current local branch is configured as When pulling: Rebase (in the Git Repositories view right-click the branch and choose Configure Branch...)
Git > Pull to make sure your commit is the latest commit in the upstream branch. If there are conflicts, you have to resolve them in the Git Staging view
Git > Push to Upstream
For details see the EGit User Guide and be aware that old Stack Overflow answers refer to outdated version of EGit.
I am very new to git and have been facing the problem below for 4-5 days now.
I have a project that I want to share on GitHub and I created a repo (https://github.com/jitix/cfs/tree/master/cfs) for the same.
Here is what I did:
Checked out the code from svn using Eclipse (Juno).
Removed svn related files and 'cleaned' the folder by doing Team > Disconnect.
Created a local git repository (using both via eclipse and cli on different occasions).
Added appropriate .gitignore file.
Committed the code into the local repo (somehow eclipse moves the folder there, but not an issue). Eclipse made me choose the $repo/cfs as the folder where the code is committed. I could not commit it to $repo.
Now I want to push it into GitHub. Tried out the following:
Method 1 (eclipse):
Team > Remote > Push
Use refs/heads/master as both source ref and dest ref and commit.
Method 2 (cli from the $repo/cfs directory):
git remote add origin jitix#https://github.com/jitix/cfs.git
git push -u origin master
Issue:
In both cases, I am getting the cfs directory under the GitHub repo, not at the root (as most projects have). Also, each folder has a .. link to the parent folder in it (something that I have never seen on GitHub, and something that does not happen if I push using svn).
I checked out my code from svn, created a local repo and committed the code into
You need to create the git repository inside the folder that you want to upload. You've created it one level above the cfs folder and then pushed that, you want to run git init while inside cfs and then go from there.
Try in commandline instead using eclipse and follow the steps that GitHub recommends.
Go inside the directory of your project and type:
git init
git commit -a -m "first commit"
git remote add origin jitix#https://github.com/jitix/cfs.git
git push -u origin master
It should work, although is pretty much what you were doing.
I am using Eclipse Helios and EGit. I am new to Git. I have an existing Eclipse project for an Android app I would like to place in Git. Can someone please share some instructions on how to setup a Git repo on a shared folder, and place the existing project into this git repo using EGit? I have tried a variety of options with no success.
Thanks!
I had the same question (how to do it in Eclipse / eGit), and I just found the answer to the question stated in the title :
either go to Window > Show View > Other... then select Git > Git repositories or click the Git repositories icon in the set of icons in the right
expand the repository to see "Remotes", right click and Create Remote
choose the option : fetch will tell eclipse you're only allowed to read (which is the correct option if you don't want/have the right to push on that repo). then name that remote repository like you want (the first is usually named "origin", but you can have "prod", "test-server", ...)
click on change to specify the uri of the repository. You can paste on the first field the complete uri you would type after "git clone"; if in GitHub you first copy the uri then it might be automatically filled in
"Finish" then "Save and Push" or "Save and Fetch" according to what you chose in 3°
Also, for creating a new project in Eclipse from an existing git repository with eGit, all you have to do is to go in File > Import...and choosing Git/Projects from Git. Then follow the steps
You can do everything from the command line instead:
Do this in the root of the project:
git init
Do the same in the folder where you want your blessed or central repository:
git init --bare
In the local repository, add a readme file and commit it:
echo "testing" > readme
git add readme
git commit -m "initial commit"
Now link and push your changes to the central repository:
git remote add origin //server/share/repodir
git push -u origin master
Hope this gets you started.
You can use egit later if you like, but there is nothing wrong with using git separately.
See http://wiki.eclipse.org/EGit/User_Guide
If you only want one project in your git repo, Team>Share Project will turn that project into a git repo. You can then create another repo on your share, and push your project repo to the shared folder repo.
If you want a repo with multiple projects, your best bet is to create the project in an external location to the workspace. Then you can create the git repo in the folder above your project.