Should I make a git fork, then a branch or just a git branch

I did not do a lot of branching in git and forked, so excuse the noob nature of this.

I am going to start work on a function (say "user oauth") that I want to work in isolation and merge at a later point. Ideally, I will merge this into a leading branch at a later point. Obviously, I would like to do this in a separate branch. Is it generally common practice only to branch in my local instance, or should I unlock the repo and create the branch in a new separate folder structure. In my opinion, the latter seems better, if I just want to destroy the branch, can I just delete this other folder structure?

THX

change 1 to ryan

git clone git@github.com:xxx/xxx.git git branch test-feature-branch 

change 2 wow, thanks for the info. Perhaps this will be the second application. Is there a way that I can clone it and then essentially push it as a new repository for the new github?

0
git git-branch git-fork
Mar 16 '12 at 17:53
source share
3 answers

The whole point of git cloning and branches is that creating separate repositories is not required. The fork is actually just another name for the clone, and as such, you can create branches for several functions at the same time in your local clone, select and choose which ones to click on the remote and / or merge into other branches (or drop).

See the answers to this question for more details: git branch, fork, fetch, merge, rebase and clone, what are the differences?

+2
Mar 16 2018-12-18T00:
source share

You cannot fork a git project. You can clone an existing one. Clone-ing basically creates a new project, starting from another.

I would not do this by adding new functionality if I do not need 2 different applications.

If you add functionally what you want it to be merged back into main using git, you can do:

 git checkout -b secondBranch 

- this will create a "secondBranch" branch and also immediately send you to this branch. The next commit will be on this second server.

If you want to remove it, just do

 git branch -d secondBranch 

or if you decide to merge it, switch to the main / main branch and insert the second bit into it.

 git branch master 

- let you master

  git merge secondBranch 

- at this moment you will be taken to the main branch with the changes made from secondBranch merged into master

+1
Mar 16 2018-12-18T00:
source share

It is definitely a common practice to simply create a branch in your local instance. When you're done, just merge it, for example. your main branch and click master at the origin.

0
Mar 16 2018-12-18T00:
source share



All Articles