Awesome, thanks!

On Wednesday, August 28, 2013 11:23:22 AM UTC-4, Konstantin Khomoutov wrote:
> On Wed, 28 Aug 2013 07:55:11 -0700 (PDT) 
> Jaace < <javascript:>> wrote: 
> [...] 
> > I made a repo as a starting point for all my projects -- the idea 
> > here is to clone this repo to use as a base for any new project I 
> > start. I want to be able to clone it and then never check it back 
> > into the repo I cloned it from, but instead create a *new* repo for 
> > that specific project. 
> > 
> > When you clone a repo, it sets up a .git directory and all that but 
> > if I were to push any changes, that would push them back to the 
> > original I cloned it from, right? 
> No.  `git clone`, being a pretty high-level command, does certain 
> convenience "magic" with the local repository it creates and populates, 
> which ties it to the original repository.  But in fact these ties are 
> very loose, and are rooted in a single bit of the local repository 
> configuration, which is the named remote -- "origin". 
> `git clone` goes like this: 
> 1) Initializes a local repo (possibly creating a directory for it 
>    first). 
> 2) Adds a single "remote" named "origin" to the repository's 
>    configuration. 
> 3) Runs `git fetch origin` which makes Git fetch all the branches the 
>    remote repository has, and create a single so-called "remote branch" 
>    (these are those "origin/master", "origin/devel" etc branches you 
>    can list by running `git branch -r`) for each branch the remote 
>    repository has. 
> 4) It then asks the remote where its HEAD reference points, and, if it 
>    points to a branch (true in 99.9% cases), creates a local branch in 
>    your repository which is linked to the matching remote branch in it 
>    (created in step 3). 
>    Most of the time remote repositories, being bare, have their HEAD 
>    point to a branch named "master", and that's why `git clone` most 
>    of the time ends up creating a local branch "master" which is set 
>    to track the remote branch "origin/master". 
> If you feel yourself lost in these "remotes", "remote branches" and 
> "remote-tracking branches", then read [1] and [2], in this order 
> (reading the whole book before embarking on using Git is highly 
> recommended); also see [3]. 
> > So is the proper way to go about doing what I want to simply delete 
> > the .git directory that comes with the cloned copy and just git init 
> > a new one or is there a better way to do this? 
> It's so simple it's ridiculous -- just do 
> git remote set-url origin GIT_URL_OF_ANOTHER_REPOSITORY 
> and then all Git commands to which you supply the name "origin" would 
> reach for that new URL.  That URL, obviously, should be of a new 
> repository (supposedly created somewhere using `git init --bare`). 
> 1. 
> 2. 
> 3. 

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to