Github update old repo with new project - github

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

Related

How do I remove this folder from my github?

I'm a beginner to using github and I accidentally added this folder to my github but I cannot find a way to remove this please help.
I tried deleting this folder from my main folder and redoing my git pull and push and in the terminal it said that this file as already been removed. But once I pushed my file again the files that needed to be updated were updated but the folder is still on my github repo.
Try:
git rm -r <folder>
git commit -m "remove folder"
git push
The changes will only be saved when you run the commit command

EGit Issue in IIB10 Toolkit

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 fix the structure of the project on GitLab?

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.

clearcase to git with gradle

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.

How to push code to root of git repository (GitHub)

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.