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
Related
I am very new to Github so please bear with me. I created a react native project with a github repository a while ago and have made commits over the past month. Recently the project stopped working so I recreated the project in a different folder on my computer. I want to update my old repository from my new project and am not quite sure how to do that. Any help would be appreciated :)
In the old repository locally from the terminal run
git pull
Commit any changes or stash and clear them if not wanted
git add .
git commit -m "updating x"
git push
Delete the node modules folder using the terminal
Delete everything else inside the folder then run
git add .
git commit -m "removed old project files"
git push
Delete the node modules folder in the new project
Copy the contents of everything inside the new project and drag and drop it in the old repo folder
In the old repo again run
git add .
git commit -m "moved new project"
git push
npm install in the old repo and confirm everything's working
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 workspace that points to an SVN repository(Eclipse Mars).
The code under this repository has been migrated to git.
How can I point to this new git repository without breaking my current workspace?
What I would do is:
Close eclipse.
Save the whole directory on a zip, just in case.
Save all your local change from the revisiĆ³n you are working on. What I would call stash your changes in git terms
inside the directory of the project, run : git init .
Set a remote to the svn clone you made on git
run git fetch --all
Find on git the exact same revision you are working on svn
Run git checkout --force the-revision-id
At this point, you could delete .svn because you are already switched to git. When starting eclipse, it should just show stuff as if you are working on git, no svn.
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.
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.