Github New Project but using same existing project - github

I completed a project. We'll call it "A". I've pushed it to the master using
git push origin master .........."the final A version"
I have a customer who wants to use "A", but with their branding. Of course these have no association.
How does one handle that? I have created a new app on Github first called "B". Is that the correct first step?
What are the steps to establish a new project on github from my local clone without fear of destroying "A"?

Sounds like you want to fork your own project. In that case, you can simply make a local copy of your git repository and push it to a new github project.
Create a new github project, name it whatever
Make a copy of project A's directory on your computer, name it B.
In the local copy of your git project, (directory B), change git's remote URL to the new github URL.
git remote set-url <new-url>
where new-url is the new URL github tells you to push to when you created the new project.
Finally push your project to github git push origin master

Related

Update a GitHub repository without cloning

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.

Changing GitHub Account Swift Project

I would like to change a swift project from one GitHub account to another account. I want to commit the project to another account but I get an error - I assume I need to remove the .git file from the project but the answer here is not working for me.
Why do that?? No, all you have to do is define the new repo, push to it, then remove the other one. Each Git repo is on a local machine. That repository can be synced with one or more remote repositories. Right now, you probably have GitHub (account 1) setup as origin (a remote). What I would do is:
rename origin to oldrepo or something
create origin with the new url
push to it
Then you can remove the old one.
To edit your remotes, you can either do commands:
git remote remove origin, get remote add origin <newUrl>
or you can edit the .git/config file with an editor.
Git: Working with Remotes

Delete all files from git repository using Sourcetree

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

GitHub: Creating a repository from an existing one and keeping it up to date with the original

There is an existing Open Source Project, say A, on GitHub which I have cloned. I have some requirements which will need modifying some of the features of this Open Source Project. So, I was thinking of creating a new Git Repository with the latest code of A and commit all my changes to this new repository, say B.
However, if there are any new changes in A, I would like to merge them with my project B. (I don't want to commit my changes to A).
I have never used GitHub (only used SVN). What is the best way of doing this?
What you need is called a remote. After you have forked the project and cloned it locally, you can just add the original as a remote by using:
git remote add myremote https://github.com/user/original_repo
After that you can pull from that remote by running
git pull myremote master
You can of course pull also any branch other than master. Pushing is similar.
You can also see a list of all remotes by one of the following commands:
git remote show
git remote -v
The full documentation can be found here and a great tutorial is here

Eclipse pull project to develop on another machine

I have a private repository on github.com and I want to pull it down to another development machine so that I can work with it in Eclipse but I am not sure exactly how to do it.
Do I have to create a local repository first or would that be created when the repository is pulled?
If you use git with eclipse, I assume you use eGit.
If you do, you can simply open File -> Import... -> Git -> Projects from Git -> Clone URI and from there everything should be clear to you. If it is not, just ask again and I will elaborate.
It will create a local repository for you if you chose so (later in the dialog you can chose something like import exisiting projects which is what you want if you already pushed your project to github once).
First, let's get eclipse out of the way. It has nothing to do with pulling/pushing to a remote repository.
The primary purpose of creating a remote repository is code collaboration. You can work on your local and then push to it. Others can pull from the remote and see your changes.
The primary way code collaboration is done in github is using the same model. To create a local branch out of a remote repository, you need to clone the repository. Cloning the repository would create a local master branch (the default branch) that will track the changes you make to your local repository. The other branch to note is the origin/master which tracks the changes you make to the remote repo.
When you want to make changes to the remote, you would need to perform three main steps:
Clone the existing repository: git clone https://github.com/johndoe/foo.git: this will create a local repository with the default master branch. You will work in this branch and when you have made the changes...
Commit the changes: git commit -m "this is the comment to identify my commit later"
Push it to the remote: git push origin master: origin refers to the remote repository; when you have cloned from the remote it is automatically called origin
So basically, you just need to clone the remote repository if you already have the remote on github. You don't need to create it separately.
You can import the project you have cloned into eclipse and work with it accordingly, then commit and push the changes to the remote.
Hope that helps.