All of lore.kernel.org
 help / color / mirror / Atom feed
* Newbie Query
@ 2009-01-20 19:19 Chris Willard
  2009-01-20 20:00 ` Tomas Carnecky
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Chris Willard @ 2009-01-20 19:19 UTC (permalink / raw)
  To: Git List

Hello All,

I am having a go at using git and need a bit of help.

I have git installed on my laptop and on my pc. I created some files
on the pc then used git close via ssh to put them on my laptop - all
OK so far!

I then modified the files, added them, commited the changes and then
used git push to put them on the PC - still no problems.

Both systems show the commits but the PC does not have the latest
version of the files. Git status on the PC shows the file as changed
but commiting give an error when pushing from the laptop. 

I assume that I need to run a command on the PC to get both systems
the same. Is it a reset or something else? 


Regards,



Chris

-- 
... "Even the gods did not spring into being overnight." Spock

--
This message was scanned by ESVA and is believed to be clean.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 19:19 Newbie Query Chris Willard
@ 2009-01-20 20:00 ` Tomas Carnecky
  2009-01-20 20:16 ` Sverre Rabbelier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Tomas Carnecky @ 2009-01-20 20:00 UTC (permalink / raw)
  To: Chris Willard; +Cc: Git List

On 01/20/2009 08:19 PM, Chris Willard wrote:
> Hello All,
>
> I am having a go at using git and need a bit of help.
>
> I have git installed on my laptop and on my pc. I created some files
> on the pc then used git close via ssh to put them on my laptop - all
> OK so far!
>
> I then modified the files, added them, commited the changes and then
> used git push to put them on the PC - still no problems.
>
> Both systems show the commits but the PC does not have the latest
> version of the files. Git status on the PC shows the file as changed
> but commiting give an error when pushing from the laptop.
>
> I assume that I need to run a command on the PC to get both systems
> the same. Is it a reset or something else?

http://git.or.cz/gitwiki/GitFaq#non-bare

tom

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 19:19 Newbie Query Chris Willard
  2009-01-20 20:00 ` Tomas Carnecky
@ 2009-01-20 20:16 ` Sverre Rabbelier
  2009-01-20 20:17 ` Reece Dunn
  2009-01-21 14:31 ` Chris Willard
  3 siblings, 0 replies; 11+ messages in thread
From: Sverre Rabbelier @ 2009-01-20 20:16 UTC (permalink / raw)
  To: Chris Willard; +Cc: Git List

Heya,

On Tue, Jan 20, 2009 at 20:19, Chris Willard <chris@thewillards.co.uk> wrote:
> I then modified the files, added them, commited the changes and then
> used git push to put them on the PC - still no problems.
>
> Both systems show the commits but the PC does not have the latest
> version of the files. Git status on the PC shows the file as changed
> but commiting give an error when pushing from the laptop.

Please read http://git.or.cz/gitwiki/GitFaq#head-b96f48bc9c925074be9f95c0fce69bcece5f6e73
and let us know if you have any other problems.


-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 19:19 Newbie Query Chris Willard
  2009-01-20 20:00 ` Tomas Carnecky
  2009-01-20 20:16 ` Sverre Rabbelier
@ 2009-01-20 20:17 ` Reece Dunn
  2009-01-20 21:07   ` Nicolas Morey-Chaisemartin
  2009-01-21 14:31 ` Chris Willard
  3 siblings, 1 reply; 11+ messages in thread
From: Reece Dunn @ 2009-01-20 20:17 UTC (permalink / raw)
  To: Chris Willard; +Cc: Git List

2009/1/20 Chris Willard <chris@thewillards.co.uk>:
> Hello All,
>
> I then modified the files, added them, commited the changes and then
> used git push to put them on the PC - still no problems.
>
> Both systems show the commits but the PC does not have the latest
> version of the files. Git status on the PC shows the file as changed
> but commiting give an error when pushing from the laptop.
>
> I assume that I need to run a command on the PC to get both systems
> the same. Is it a reset or something else?

So IIUC running 'git log' on the machine you pushed the changes to,
you can see the checkin you made on the machine you made the change
on? You need to run 'git checkout' on the machine you pushed to, to
tell git that you want these files. This is a safety feature, since
someone may be working on the files on that machine locally, and so
doesn't want them being overwritten by your push.

You may find the documentation (http://git-scm.com/documentation)
useful, especially
http://www.kernel.org/pub/software/scm/git/docs/everyday.html which
has your scenario under "Push into another repository. ".

If you want someone to take some changes you made, it is recommended
to let them know so that they can run 'git pull' or 'git fetch' to get
your changes (performing a merge or rebase as desired). This means
that they control when they get the updates and what they want to do
with them.

If you are committing the files to a shared public repository (e.g. a
central repository, or build server repository), a pussible approach
is to create that as a "bare" repository (one with just the contents
of the .git folder - i.e. it does not have any files checked out). You
can do this by running:
    git clone --bare source/git/path/project project.git
you can then clone from this:
    git clone my/shared/project.git
and push any changes to it as normal.

The build server can then do a 'git pull' to get the new changes from
that repository.

You can keep it setup like you currently have (assuming that where you
are pushing to is a shared repository), and do:
    git checkout HEAD
before you run a build (assuming this is the repository that you are
using for your builds). The advantage of a bare repository is that it
will take up less space, and using a different (cloned) repository for
performing builds keeps the main repository clean.

One of the great things about git is that you can customise it to fit
different workflows.

HTH,
- Reece

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 20:17 ` Reece Dunn
@ 2009-01-20 21:07   ` Nicolas Morey-Chaisemartin
  2009-01-20 21:34     ` Boyd Stephen Smith Jr.
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Morey-Chaisemartin @ 2009-01-20 21:07 UTC (permalink / raw)
  To: Reece Dunn; +Cc: Git List

Reece Dunn a écrit :
>
> If you are committing the files to a shared public repository (e.g. a
> central repository, or build server repository), a pussible approach
> is to create that as a "bare" repository (one with just the contents
> of the .git folder - i.e. it does not have any files checked out). You
> can do this by running:
>     git clone --bare source/git/path/project project.git
> you can then clone from this:
>     git clone my/shared/project.git
> and push any changes to it as normal.
>
>   
Hi,

I did the rookie mistkae on the central server to create the main
reposity in non-bare mode. So i need to checkout the HEAD revision each
time I push.
Is there a cleaner way to convert a non-bare git repo into a bare repo
than cloning it?
My repo have a lot of remote branch registered, and cloning them to a
new bare repo mean I'll have to add all those remote branches again
(except if there is another trick here I don't know about).

Regards

Nicolas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 21:07   ` Nicolas Morey-Chaisemartin
@ 2009-01-20 21:34     ` Boyd Stephen Smith Jr.
  2009-01-20 21:46       ` Nicolas Morey-Chaisemartin
  0 siblings, 1 reply; 11+ messages in thread
From: Boyd Stephen Smith Jr. @ 2009-01-20 21:34 UTC (permalink / raw)
  To: devel; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]

On Tuesday 2009 January 20 15:07:55 Nicolas Morey-Chaisemartin wrote:
>I did the rookie mistkae on the central server to create the main
>reposity in non-bare mode. So i need to checkout the HEAD revision each
>time I push.
>Is there a cleaner way to convert a non-bare git repo into a bare repo
>than cloning it?
>My repo have a lot of remote branch registered, and cloning them to a
>new bare repo mean I'll have to add all those remote branches again
>(except if there is another trick here I don't know about).

Well, if you can make sure no one is pushing into the repo for a bit: clone it 
and replace the original with a symlink to new, bare one.  Your clients will 
be able to use the same URL, so they should be happy.  (I haven't tried this, 
but it should work.)
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 21:34     ` Boyd Stephen Smith Jr.
@ 2009-01-20 21:46       ` Nicolas Morey-Chaisemartin
  2009-01-20 22:24         ` Boyd Stephen Smith Jr.
  2009-01-20 23:51         ` Jeff King
  0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Morey-Chaisemartin @ 2009-01-20 21:46 UTC (permalink / raw)
  To: Boyd Stephen Smith Jr.; +Cc: git

Boyd Stephen Smith Jr. a écrit :
> On Tuesday 2009 January 20 15:07:55 Nicolas Morey-Chaisemartin wrote:
>   
>> I did the rookie mistkae on the central server to create the main
>> reposity in non-bare mode. So i need to checkout the HEAD revision each
>> time I push.
>> Is there a cleaner way to convert a non-bare git repo into a bare repo
>> than cloning it?
>> My repo have a lot of remote branch registered, and cloning them to a
>> new bare repo mean I'll have to add all those remote branches again
>> (except if there is another trick here I don't know about).
>>     
>
> Well, if you can make sure no one is pushing into the repo for a bit: clone it 
> and replace the original with a symlink to new, bare one.  Your clients will 
> be able to use the same URL, so they should be happy.  (I haven't tried this, 
> but it should work.)
>   
Well I know there are solutions to convert it to a bare repo.
I was just wondering if there was a "clean" one which really converts
the repo to a bare one and not create a copy which is bare.
I don't know how bare/non-bare is managed but I guess both types of repo
are not differing by much, so it'd be great to have a function to
convert from one to another.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 21:46       ` Nicolas Morey-Chaisemartin
@ 2009-01-20 22:24         ` Boyd Stephen Smith Jr.
  2009-01-20 23:51         ` Jeff King
  1 sibling, 0 replies; 11+ messages in thread
From: Boyd Stephen Smith Jr. @ 2009-01-20 22:24 UTC (permalink / raw)
  To: devel; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1801 bytes --]

On Tuesday 2009 January 20 15:46:47 Nicolas Morey-Chaisemartin wrote:
>Boyd Stephen Smith Jr. a écrit :
>> On Tuesday 2009 January 20 15:07:55 Nicolas Morey-Chaisemartin wrote:
>>> I did the rookie mistkae on the central server to create the main
>>> reposity in non-bare mode.
>>> Is there a cleaner way to convert a non-bare git repo into a bare repo
>>> than cloning it?

No.

>>> My repo have a lot of remote branch registered, and cloning them to a
>>> new bare repo mean I'll have to add all those remote branches again
>>> (except if there is another trick here I don't know about).
>>
>> Well, if you can make sure no one is pushing into the repo for a bit:
>> clone it and replace the original with a symlink to new, bare one.  Your
>> clients will be able to use the same URL, so they should be happy.  (I
>> haven't tried this, but it should work.)
>
>Well I know there are solutions to convert it to a bare repo.
>I was just wondering if there was a "clean" one which really converts
>the repo to a bare one and not create a copy which is bare.

The clone *is* a way to convert, with the added advantage of not trashing the 
original during the conversion, by putting the results in a different 
location.  In fact, it's probably *cleaner* than any convert-in-place.

>I don't know how bare/non-bare is managed but I guess both types of repo
>are not differing by much, so it'd be great to have a function to
>convert from one to another.

I couldn't tell you all the differences, but I don't think there are many 
either.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 21:46       ` Nicolas Morey-Chaisemartin
  2009-01-20 22:24         ` Boyd Stephen Smith Jr.
@ 2009-01-20 23:51         ` Jeff King
  2009-01-21  0:05           ` Johannes Schindelin
  1 sibling, 1 reply; 11+ messages in thread
From: Jeff King @ 2009-01-20 23:51 UTC (permalink / raw)
  To: Nicolas Morey-Chaisemartin; +Cc: Boyd Stephen Smith Jr., git

On Tue, Jan 20, 2009 at 10:46:47PM +0100, Nicolas Morey-Chaisemartin wrote:

> Well I know there are solutions to convert it to a bare repo.
> I was just wondering if there was a "clean" one which really converts
> the repo to a bare one and not create a copy which is bare.

It has been a long time since I have done this. It used to be that you
could simply "mv foo/.git foo.git" and be done with it. These days I
think you would also need "git config core.bare true". But I haven't
actually tested it recently.

You may also want to tweak other config settings (e.g., bare
repositories do not generally have reflogs turned on, but non-bare do).

-Peff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 23:51         ` Jeff King
@ 2009-01-21  0:05           ` Johannes Schindelin
  0 siblings, 0 replies; 11+ messages in thread
From: Johannes Schindelin @ 2009-01-21  0:05 UTC (permalink / raw)
  To: Jeff King; +Cc: Nicolas Morey-Chaisemartin, Boyd Stephen Smith Jr., git

Hi,

On Tue, 20 Jan 2009, Jeff King wrote:

> On Tue, Jan 20, 2009 at 10:46:47PM +0100, Nicolas Morey-Chaisemartin wrote:
> 
> > Well I know there are solutions to convert it to a bare repo.
> > I was just wondering if there was a "clean" one which really converts
> > the repo to a bare one and not create a copy which is bare.
> 
> It has been a long time since I have done this. It used to be that you 
> could simply "mv foo/.git foo.git" and be done with it. These days I 
> think you would also need "git config core.bare true". But I haven't 
> actually tested it recently.

Yep, you need to set that option.  At least if you initialized your 
repository with anything newer than v1.5.0-rc1~3^2~2.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Newbie Query
  2009-01-20 19:19 Newbie Query Chris Willard
                   ` (2 preceding siblings ...)
  2009-01-20 20:17 ` Reece Dunn
@ 2009-01-21 14:31 ` Chris Willard
  3 siblings, 0 replies; 11+ messages in thread
From: Chris Willard @ 2009-01-21 14:31 UTC (permalink / raw)
  To: Git List

On Tue, 20 Jan 2009, Chris Willard wrote:

> Hello All,
> 
> I am having a go at using git and need a bit of help.
[snip]

Thanks for all the tips - I used "git-reset --hard" to solve my
problem.

Regards,

Chris


-- 
-----------(  "The Batman play seemed important to Crow." --  )------------
-----------(                   Mike Nelson                    )------------
Chris -----(                                                  )---- Willard
                             Htag.pl 0.0.23

--
This message was scanned by ESVA and is believed to be clean.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-01-21 14:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-20 19:19 Newbie Query Chris Willard
2009-01-20 20:00 ` Tomas Carnecky
2009-01-20 20:16 ` Sverre Rabbelier
2009-01-20 20:17 ` Reece Dunn
2009-01-20 21:07   ` Nicolas Morey-Chaisemartin
2009-01-20 21:34     ` Boyd Stephen Smith Jr.
2009-01-20 21:46       ` Nicolas Morey-Chaisemartin
2009-01-20 22:24         ` Boyd Stephen Smith Jr.
2009-01-20 23:51         ` Jeff King
2009-01-21  0:05           ` Johannes Schindelin
2009-01-21 14:31 ` Chris Willard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.