The goal is to delete all file from my git repository: I want to remove all files from my git repository and I will update new code at the Repository.
How would I do that, knowing I am using sourcetree windows app?
i want to remove all files from my git repository and i will update new code at the Repository.
Is that better or I have to create new fresh repository
It is easier to, on the GitHub website:
rename the current repo
re-create a brand new repo (reusing the same name as the one you just renamed, if you want)
clone that new repo
add your data in it, commit and push
Related
Here's the situation, we are currently working on a project and lately we decided to upload it on GitHub. Now I made my changes and I want to push the changes onto the repository.
As far as I read, in order to make changes you need to clone the repository but that will download all files from the repository and I already have all of the source files.
I'm using GitHub desktop and I can't find any option to clone without downloading and update or create branches from my existing files. Creating a local one is an option but it needs to be uploaded as a separate repository instead of linking it to a current one.
Is there any way to push updates, create branches to the repository from my local project to an existing repository?
Your local project should already be a git repo, if you uploaded it to GitHub.
But in case it is not, switch to command-line, and do inside the root folder of your project (which should shows the same files as your remote repo):
git init .
git remote add origin https://github.com/<user>/<project>
git fetch
The fetch part will download the repo but leave your files alone.
(But do a backup still, just to be safe)
git branch master origin/master
git reset master
From there, your GitHub Desktop should show you any diff between your files and what was fetched from the repo.
I have files for a website in a folder on my computer that I'd like to put on GitHub. Do I create a repository in GitHub Desktop first or create a repository on GitHub first? And once I have a repository what is the very first thing I do to move those files into the repository? This may be a stupid question but I've made a mess of things and I'm very confused at this point.
Create a repository on GitHub
git clone your new repository on your computer
Copy the files you want to push to your repository inside the new folder created by cloning
git add --all to add all these files for commit
git commit -m "Initial commit" to create a commit
git push to push this commit to your GitHub repository
We're trying to use Git source control for our NetSuite SuiteScript. How can I synch my Eclipse SuiteScript workspace files with my local git repo if the local repo already contains the files (meaning "Share Project" won't work)?
I've already setup a Git Repo for our NetSuite SuiteScript library. The initial setup was simple because I pulled down our file cabinet using the SuiteCloud IDE (Eclipse/NetSuite bundle), added an existing local git repo, and used the Eclipse Team > Share Project feature to push the SuiteScript files to the repo. However, that method only works the first time through.
Our other developers aren't able to use the Share Project feature to synch the projects with the Repo since the files already exist in both locations. The challenge is that the files need to be pulled directly from NetSuite first in order to have the necessary indexes for the File Cabinet.
I think you should be able to pull files from file cabinet, do git init , commit files to git repo, and then delete the project from workspace. This would ensure the files exists in netsuite and git repo both.
Now, you can take a similar approach as in the case where files existed in both NetSuite and git repo, by creating new project and pulling up the files again from NetSuite and adding git repo info.
I found a way to do this.
Clone your remote repo (can use init too but easier with clone IMO)
Delete all the files in your repo
Pull all the files into Eclipse from NetSuite.
Use Team > Share Project to synch with your repo
Use fetch to reset to the remote repo
git fetch
git reset --hard origin/master
After this you're all set.
I just migrated an old project from an own Subversion/Trac infrastructure to GitHub
https://github.com/matteocorti/nagios_plugins
The repository contains one directory for each plugin I wrote. Each plugin is standalone and has an own version number (but the source code is in the same repository).
When I release a new plugin version I would like to have a release with just the corresponding folder (e.g., https://github.com/matteocorti/nagios_plugins/tree/master/check_updates)
Is there a way with the GitHub release feature to select which part of a repository contains the software to be released?
Another option would be to split the whole and have a repository for each plugin. This would imply that I will have to manually move all the issues/bugs and wiki pages.
Edit
It seems that the only solution would be to split the repository (a separate repository for each plugin).
How can I split a Git repository retaining the commit history?
It seems that the only solution would be to split the repository (a separate repository for each plugin).
It is, but that does not migrate wiki pages and issues.
To split a git repo while keeping the history, see GitHub page "Splitting a subfolder out into a new repository"
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
git filter-branch --prune-empty --subdirectory-filter \
YOUR_FOLDER_NAME master
# Filter the master branch to your directory and remove empty commits
# Rewrite 48dc599c80e20527ed902928085e7861e6b3cbe6 (89/89)
# Ref 'refs/heads/master' was rewritten
The repository now contains all the files that were in your subfolder.
Note that although all of your previous files have been removed, they still exist within the Git history. You can now push your new local repository to a new repository on GitHub.
Check also "How to tear apart a repository: the Git way "
Once you have one repo per plugin, you can still register them in your original repo, as git submodules.
Edit
To push the subfolder to a new repository
git remote rename origin upstream
git remote add origin NEW_URL
git push origin master
I have a project in Eclipse that I want to put on github, so I went to github and created the repos for them, but I want to clone them right into the folder where the files are stored in my eclipse workspace. How can I do this?
EDIT: When I try it, the github app says it can't clone because the folder isn't empty.
EDIT 2: Will this work? Changing the name in eclipse to rename the project folder, then cloning the repo to the name I want, in the workspace, then renaming the eclipse project so they merge and I can commit the new files.
GitHub has a guide explaining how to put an existing project on GitHub.
You should not clone the repository, but add the GitHub repository as a remote to a local repository you create yourself.
Go to your project folder and initialize a local repository with git init
Add and commit all your project files to the local repository. (e.g. git add . and git commit -m "message")
Add the GitHub repository as a remote. git remote add origin *github repository URL* (Verify with git remote -v)
Push your project to GitHub with git push origin master.
If you already have committed files to the GitHub repository, it is still possible.
Initialize your local repository.
Add GitHub as the remote.
Pull from GitHub.
Add and commit your project.
Push you project to GitHub
First add the remote as follows
git remote add origin <GIT URL>
Then simply do the following (MAke sure to commit any of your local files)
git pull --allow-unrelated-histories