* A question about changing remote repo name @ 2010-01-04 6:45 Dongas 2010-01-04 20:09 ` Miklos Vajna 2010-01-05 2:52 ` Russell Steicke 0 siblings, 2 replies; 14+ messages in thread From: Dongas @ 2010-01-04 6:45 UTC (permalink / raw) To: git Hi ALL, I'm running ubuntu 9.04 and the git coming along with it doesn't support git remote rename command. Below is the man page of it: GIT-REMOTE(1) Git Manual GIT-REMOTE(1) NAME git-remote - manage set of tracked repositories SYNOPSIS git remote [-v | --verbose] git remote add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url> git remote rm <name> git remote show [-n] <name> git remote prune [-n | --dry-run] <name> git remote update [group] Note: There's no rename option. So i need to change the remote name manually. I tried modifying the .git/config file locally but it didn't work. Could someone help tell how to do it? Thanks Regards Dongas ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-04 6:45 A question about changing remote repo name Dongas @ 2010-01-04 20:09 ` Miklos Vajna 2010-01-05 1:53 ` Dongas 2010-01-05 2:52 ` Russell Steicke 1 sibling, 1 reply; 14+ messages in thread From: Miklos Vajna @ 2010-01-04 20:09 UTC (permalink / raw) To: Dongas; +Cc: git [-- Attachment #1: Type: text/plain, Size: 258 bytes --] On Mon, Jan 04, 2010 at 02:45:09PM +0800, Dongas <dongas86@gmail.com> wrote: > I'm running ubuntu 9.04 and the git coming along with it doesn't > support git remote rename command. It first appeared in v1.6.1, about a year ago. What does 'git version' say? [-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-04 20:09 ` Miklos Vajna @ 2010-01-05 1:53 ` Dongas 2010-01-05 1:57 ` Erik Faye-Lund 0 siblings, 1 reply; 14+ messages in thread From: Dongas @ 2010-01-05 1:53 UTC (permalink / raw) To: Miklos Vajna; +Cc: git 2010/1/5 Miklos Vajna <vmiklos@frugalware.org>: > On Mon, Jan 04, 2010 at 02:45:09PM +0800, Dongas <dongas86@gmail.com> wrote: >> I'm running ubuntu 9.04 and the git coming along with it doesn't >> support git remote rename command. > > It first appeared in v1.6.1, about a year ago. What does 'git version' > say? Thanks a lot for your reply. # git --version git version 1.6.0.4 It seems the ubuntu9.04 doesn't have the repo source to update to a higher git version than 1.6.0.4, i'd like to know if there's a manual way to rename the git remote name with this version. Regards Dongas ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-05 1:53 ` Dongas @ 2010-01-05 1:57 ` Erik Faye-Lund 2010-01-05 2:25 ` Dongas 0 siblings, 1 reply; 14+ messages in thread From: Erik Faye-Lund @ 2010-01-05 1:57 UTC (permalink / raw) To: Dongas; +Cc: Miklos Vajna, git On Tue, Jan 5, 2010 at 2:53 AM, Dongas <dongas86@gmail.com> wrote: > 2010/1/5 Miklos Vajna <vmiklos@frugalware.org>: >> On Mon, Jan 04, 2010 at 02:45:09PM +0800, Dongas <dongas86@gmail.com> wrote: >>> I'm running ubuntu 9.04 and the git coming along with it doesn't >>> support git remote rename command. >> >> It first appeared in v1.6.1, about a year ago. What does 'git version' >> say? > > Thanks a lot for your reply. > > # git --version > git version 1.6.0.4 > > It seems the ubuntu9.04 doesn't have the repo source to update to a > higher git version than 1.6.0.4, > i'd like to know if there's a manual way to rename the git remote name > with this version. > I know this isn't REALLY answering your question, but you should seriously consider upgrading. 1.6.0.4 is ancient. -- Erik "kusma" Faye-Lund ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-05 1:57 ` Erik Faye-Lund @ 2010-01-05 2:25 ` Dongas 0 siblings, 0 replies; 14+ messages in thread From: Dongas @ 2010-01-05 2:25 UTC (permalink / raw) To: kusmabite; +Cc: Miklos Vajna, git 2010/1/5 Erik Faye-Lund <kusmabite@googlemail.com>: > On Tue, Jan 5, 2010 at 2:53 AM, Dongas <dongas86@gmail.com> wrote: >> 2010/1/5 Miklos Vajna <vmiklos@frugalware.org>: >>> On Mon, Jan 04, 2010 at 02:45:09PM +0800, Dongas <dongas86@gmail.com> wrote: >>>> I'm running ubuntu 9.04 and the git coming along with it doesn't >>>> support git remote rename command. >>> >>> It first appeared in v1.6.1, about a year ago. What does 'git version' >>> say? >> >> Thanks a lot for your reply. >> >> # git --version >> git version 1.6.0.4 >> >> It seems the ubuntu9.04 doesn't have the repo source to update to a >> higher git version than 1.6.0.4, >> i'd like to know if there's a manual way to rename the git remote name >> with this version. >> > > I know this isn't REALLY answering your question, but you should > seriously consider upgrading. 1.6.0.4 is ancient. > Thanks a lot for your advices. Unfortunately, all my team members are running ubuntu 9.04. If i could find a easy way to upgrade it, it will take it. Regards Dongas ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-04 6:45 A question about changing remote repo name Dongas 2010-01-04 20:09 ` Miklos Vajna @ 2010-01-05 2:52 ` Russell Steicke 2010-01-05 4:30 ` Dongas 1 sibling, 1 reply; 14+ messages in thread From: Russell Steicke @ 2010-01-05 2:52 UTC (permalink / raw) To: Dongas; +Cc: git On Mon, Jan 4, 2010 at 2:45 PM, Dongas <dongas86@gmail.com> wrote: > So i need to change the remote name manually. > > I tried modifying the .git/config file locally but it didn't work. > > Could someone help tell how to do it? After editing .git/config, do this: $ mv .git/refs/remotes/OLDNAME .git/refs/remotes/NEWNAME and optionally: $ mv .git/logs/refs/remotes/OLDNAME .git/logs/refs/remotes/NEWNAME Remember to rename the remote in any tracking branches in .git/config, as well as the name in the [remote "OLDNAME"] section, and the name in any fetch and push lines. ie [remote "OLDNAME"] url = something fetch = +refs/heads/*:refs/remotes/OLDNAME/* [branch "master"] remote = OLDNAME merge = refs/heads/master Becomes [remote "NEWNAME"] url = something fetch = +refs/heads/*:refs/remotes/NEWNAME/* [branch "master"] remote = NEWNAME merge = refs/heads/master -- Virus found in this message. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-05 2:52 ` Russell Steicke @ 2010-01-05 4:30 ` Dongas 2010-01-05 21:15 ` David Aguilar 2010-01-06 0:07 ` Russell Steicke 0 siblings, 2 replies; 14+ messages in thread From: Dongas @ 2010-01-05 4:30 UTC (permalink / raw) To: Russell Steicke; +Cc: git 2010/1/5 Russell Steicke <russellsteicke@gmail.com>: > On Mon, Jan 4, 2010 at 2:45 PM, Dongas <dongas86@gmail.com> wrote: >> So i need to change the remote name manually. >> >> I tried modifying the .git/config file locally but it didn't work. >> >> Could someone help tell how to do it? > > After editing .git/config, do this: > > $ mv .git/refs/remotes/OLDNAME .git/refs/remotes/NEWNAME > > and optionally: > > $ mv .git/logs/refs/remotes/OLDNAME .git/logs/refs/remotes/NEWNAME > > Remember to rename the remote in any tracking branches in .git/config, > as well as the name in the [remote "OLDNAME"] section, and the name in > any fetch and push lines. ie > > [remote "OLDNAME"] > url = something > fetch = +refs/heads/*:refs/remotes/OLDNAME/* > [branch "master"] > remote = OLDNAME > merge = refs/heads/master > > Becomes > > [remote "NEWNAME"] > url = something > fetch = +refs/heads/*:refs/remotes/NEWNAME/* > [branch "master"] > remote = NEWNAME > merge = refs/heads/master Thanks a lot, Russell. I followed you instruction but it seemed it needs more changes. Below are the steps: Original: root@ubuntu:/work/git-repo/free_monkey# tree -a . |-- .git | |-- HEAD | |-- branches | |-- config | |-- description | |-- hooks | | |-- applypatch-msg.sample | | |-- commit-msg.sample | | |-- post-commit.sample | | |-- post-receive.sample | | |-- post-update.sample | | |-- pre-applypatch.sample | | |-- pre-commit.sample | | |-- pre-rebase.sample | | |-- prepare-commit-msg.sample | | `-- update.sample | |-- index | |-- info | | `-- exclude | |-- logs | | |-- HEAD | | `-- refs | | |-- heads | | | `-- master | | `-- remotes | | `-- origin | | `-- HEAD | |-- objects | | |-- info | | `-- pack | | |-- pack-f4beae76253ca8d36af31c42320462b5cf4940fc.idx | | `-- pack-f4beae76253ca8d36af31c42320462b5cf4940fc.pack | |-- packed-refs | `-- refs | |-- heads | | `-- master | |-- remotes | | `-- origin | | `-- HEAD | `-- tags `-- hello1 root@ubuntu:/work/git-repo/free_monkey# cat .git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = git@192.168.1.116:free_monkey.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master root@ubuntu:/work/git-repo/free_monkey# Execute your steps.... Becomes: root@ubuntu:/work/git-repo/free_monkey# tree -a . |-- .git | |-- HEAD | |-- branches | |-- config | |-- description | |-- hooks | | |-- applypatch-msg.sample | | |-- commit-msg.sample | | |-- post-commit.sample | | |-- post-receive.sample | | |-- post-update.sample | | |-- pre-applypatch.sample | | |-- pre-commit.sample | | |-- pre-rebase.sample | | |-- prepare-commit-msg.sample | | `-- update.sample | |-- index | |-- info | | `-- exclude | |-- logs | | |-- HEAD | | `-- refs | | |-- heads | | | `-- master | | `-- remotes | | `-- karmic | | `-- HEAD | |-- objects | | |-- info | | `-- pack | | |-- pack-f4beae76253ca8d36af31c42320462b5cf4940fc.idx | | `-- pack-f4beae76253ca8d36af31c42320462b5cf4940fc.pack | |-- packed-refs | `-- refs | |-- heads | | `-- master | |-- remotes | | `-- karmic | | `-- HEAD | `-- tags `-- hello1 root@ubuntu:/work/git-repo/free_monkey# cat .git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "karmic"] url = git@192.168.1.116:free_monkey.git fetch = +refs/heads/*:refs/remotes/karmic/* [branch "master"] remote = karmic merge = refs/heads/master But the result was: root@ubuntu:/work/git-repo/free_monkey# git branch -a * master karmic/HEAD origin/master The 'origin/master' was still not changed. I did a few more steps: root@ubuntu:/work/git-repo/free_monkey# grep -wrin 'origin' . ./.git/packed-refs:2:abfae429bb4081043e84681e5ee94102085f87e0 refs/remotes/origin/master ./.git/refs/remotes/karmic/HEAD:1:ref: refs/remotes/origin/master Change 'origin' to 'karmic' in above files. Then, root@ubuntu:/work/git-repo/free_monkey# git branch -a * master karmic/HEAD karmic/master The steps are a little complicated. Do you know if there's a way to rename the remote on server side? If there is, then everyone could just clone the project with a new remote name rather than the defaul 'origin'. Thanks Regards Dongas ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-05 4:30 ` Dongas @ 2010-01-05 21:15 ` David Aguilar 2010-01-06 3:55 ` Dongas 2010-01-06 0:07 ` Russell Steicke 1 sibling, 1 reply; 14+ messages in thread From: David Aguilar @ 2010-01-05 21:15 UTC (permalink / raw) To: Dongas; +Cc: Russell Steicke, git Hi, On Tue, Jan 05, 2010 at 12:30:03PM +0800, Dongas wrote: > 2010/1/5 Russell Steicke <russellsteicke@gmail.com>: > > On Mon, Jan 4, 2010 at 2:45 PM, Dongas <dongas86@gmail.com> wrote: > > Thanks a lot, Russell. > I followed you instruction but it seemed it needs more changes. > > Execute your steps.... > Becomes: > root@ubuntu:/work/git-repo/free_monkey# tree -a Just a note: I would recommend against being root. You cloned the repo so you should own it. More below... > root@ubuntu:/work/git-repo/free_monkey# cat .git/config > [core] > repositoryformatversion = 0 > filemode = true > bare = false > logallrefupdates = true > [remote "karmic"] > url = git@192.168.1.116:free_monkey.git > fetch = +refs/heads/*:refs/remotes/karmic/* > [branch "master"] > remote = karmic > merge = refs/heads/master > > But the result was: > root@ubuntu:/work/git-repo/free_monkey# git branch -a > * master > karmic/HEAD > origin/master > The 'origin/master' was still not changed. A safter alternative would be to leave the "origin" lines in place as a duplicate of karmic: [remote "karmic"] url = git@192.168.1.116:free_monkey.git fetch = +refs/heads/*:refs/karmic/origin/* [remote "origin"] url = git@192.168.1.116:free_monkey.git fetch = +refs/heads/*:refs/remotes/origin/* At that point you will have two remotes, "karmic" and "origin". "git fetch karmic" to get the latest branches. Finally, "git remote rm origin" to remove all references to it. > I did a few more steps: > root@ubuntu:/work/git-repo/free_monkey# grep -wrin 'origin' . > ./.git/packed-refs:2:abfae429bb4081043e84681e5ee94102085f87e0 > refs/remotes/origin/master > ./.git/refs/remotes/karmic/HEAD:1:ref: refs/remotes/origin/master > > Change 'origin' to 'karmic' in above files. You can skip this step by using "git remote rm" as described above. > The steps are a little complicated. > Do you know if there's a way to rename the remote on server side? > If there is, then everyone could just clone the project with a new > remote name rather than the defaul 'origin'. Unfortunately, no. "origin" is actually a local thing. Your local git client gives it that name. As you can see, the remote does not care whether we call it "origin" or "karmic". There were some patches flying around on the ML some time ago that allowed you to change the default "origin" name on the client side at "git clone" time (or maybe patches never materialized and it was purely discussion). That was a while ago (probably over a year ago) and this wasn't anybody's itch to scratch in the meantime so nothing every materialized. It think this is only the 2nd time this has come up in that whole time. Sorry, I wasn't able to find the thread. Here's a nice middle ground -- instead of naming your branch "master" you can call your default branch "karmic". To make it the default for "git clone" then you'll need to push your local master branch and call it "karmic" over there: git push origin master:karmic Then, go to that server and change the repo's HEAD entry so that it points to karmic instead of master. ssh admin@gitbox cd /path/to/repo.git vi HEAD >From then on, everyone who clones the repo will have a "karmic" branch by default instead of the master branch. To get that branch on repos that were cloned before the change: git fetch origin git checkout -b karmic origin/karmic With this setup you might even want to remove the "master" branch altogether since it might be confusing to have both: Once: git push origin :master In everyone's repo: git remote prune origin You will need to make sure everyone has either: a) cloned from the new master-less repo b) run the "checkout -b" and "remote prune" commands Otherwise someone'll likely "git push" the master branch back into existence. -- David ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-05 21:15 ` David Aguilar @ 2010-01-06 3:55 ` Dongas 0 siblings, 0 replies; 14+ messages in thread From: Dongas @ 2010-01-06 3:55 UTC (permalink / raw) To: David Aguilar; +Cc: Russell Steicke, git 2010/1/6 David Aguilar <davvid@gmail.com>: > > Hi, > > On Tue, Jan 05, 2010 at 12:30:03PM +0800, Dongas wrote: >> 2010/1/5 Russell Steicke <russellsteicke@gmail.com>: >> > On Mon, Jan 4, 2010 at 2:45 PM, Dongas <dongas86@gmail.com> wrote: >> >> Thanks a lot, Russell. >> I followed you instruction but it seemed it needs more changes. >> >> Execute your steps.... >> Becomes: >> root@ubuntu:/work/git-repo/free_monkey# tree -a > > Just a note: I would recommend against being root. > You cloned the repo so you should own it. Thanks for your advices. > More below... > > >> root@ubuntu:/work/git-repo/free_monkey# cat .git/config >> [core] >> repositoryformatversion = 0 >> filemode = true >> bare = false >> logallrefupdates = true >> [remote "karmic"] >> url = git@192.168.1.116:free_monkey.git >> fetch = +refs/heads/*:refs/remotes/karmic/* >> [branch "master"] >> remote = karmic >> merge = refs/heads/master >> >> But the result was: >> root@ubuntu:/work/git-repo/free_monkey# git branch -a >> * master >> karmic/HEAD >> origin/master >> The 'origin/master' was still not changed. > > > A safter alternative would be to leave the "origin" lines in > place as a duplicate of karmic: > > [remote "karmic"] > url = git@192.168.1.116:free_monkey.git > fetch = +refs/heads/*:refs/karmic/origin/* > > [remote "origin"] > url = git@192.168.1.116:free_monkey.git > fetch = +refs/heads/*:refs/remotes/origin/* > > > At that point you will have two remotes, "karmic" and "origin". > "git fetch karmic" to get the latest branches. > > Finally, "git remote rm origin" to remove all references to it. It's a good idea. I have tried and it seemed to work. (I also did a few more works to make it better) Below is the result: root@ubuntu:/work/git-repo/tmp/free_monkey# git branch -a * master origin/HEAD origin/master root@ubuntu:/work/git-repo/tmp/free_monkey# cat .git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = git@192.168.1.106:free_monkey.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master root@ubuntu:/work/git-repo/tmp/free_monkey# git remote add karmic git@192.168.1.106:free_monkey.git root@ubuntu:/work/git-repo/tmp/free_monkey# git fetch karmic From git@192.168.1.106:free_monkey * [new branch] master -> karmic/master root@ubuntu:/work/git-repo/tmp/free_monkey# git branch -a * master karmic/master origin/HEAD origin/master root@ubuntu:/work/git-repo/tmp/free_monkey# git remote rm origin root@ubuntu:/work/git-repo/tmp/free_monkey# git branch -a * master karmic/master However there's a little issue: root@ubuntu:/work/git-repo/tmp/free_monkey# git pull fatal: 'origin': unable to chdir or not a git archive fatal: The remote end hung up unexpectedly root@ubuntu:/work/git-repo/tmp/free_monkey# grep -wrin 'origin' .git/ root@ubuntu:/work/git-repo/tmp/free_monkey# cat .git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [branch "master"] [remote "karmic"] url = git@192.168.1.106:free_monkey.git fetch = +refs/heads/*:refs/remotes/karmic/* But 'git pull karmic master' worked well. root@ubuntu:/work/git-repo/tmp/free_monkey# git pull karmic master From git@192.168.1.106:free_monkey * branch master -> FETCH_HEAD Already up-to-date. For conveniently, i did a few more steps. Add two lines below '[branch "master"]': root@ubuntu:/work/git-repo/tmp/free_monkey# cat .git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [branch "master"] remote = karmic merge = refs/heads/master [remote "karmic"] url = git@192.168.1.106:free_monkey.git fetch = +refs/heads/*:refs/remotes/karmic/* Then, 'git pull' worked well. root@ubuntu:/work/git-repo/tmp/free_monkey# git pull Already up-to-date. > That was a while ago (probably over a year ago) and this wasn't > anybody's itch to scratch in the meantime so nothing every > materialized. It think this is only the 2nd time this has come > up in that whole time. Sorry, I wasn't able to find the thread. Thanks for the info. > Here's a nice middle ground -- > > instead of naming your branch "master" you can call your default > branch "karmic". > > To make it the default for "git clone" then you'll need to push > your local master branch and call it "karmic" over there: > > git push origin master:karmic > > Then, go to that server and change the repo's HEAD entry so that > it points to karmic instead of master. > > ssh admin@gitbox > cd /path/to/repo.git > vi HEAD > > From then on, everyone who clones the repo will have a "karmic" > branch by default instead of the master branch. > > To get that branch on repos that were cloned before the change: > > git fetch origin > git checkout -b karmic origin/karmic > > > > With this setup you might even want to remove the "master" > branch altogether since it might be confusing to have both: > > Once: > git push origin :master > > In everyone's repo: > git remote prune origin > > > You will need to make sure everyone has either: > a) cloned from the new master-less repo > b) run the "checkout -b" and "remote prune" commands > > Otherwise someone'll likely "git push" the master branch back > into existence. Thanks a lot for the alternative way , it looks good. Regards Dongas ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-05 4:30 ` Dongas 2010-01-05 21:15 ` David Aguilar @ 2010-01-06 0:07 ` Russell Steicke 2010-01-06 0:27 ` Johannes Schindelin ` (2 more replies) 1 sibling, 3 replies; 14+ messages in thread From: Russell Steicke @ 2010-01-06 0:07 UTC (permalink / raw) To: Dongas; +Cc: git On Tue, Jan 5, 2010 at 12:30 PM, Dongas <dongas86@gmail.com> wrote: > I did a few more steps: > root@ubuntu:/work/git-repo/free_monkey# grep -wrin 'origin' . > ./.git/packed-refs:2:abfae429bb4081043e84681e5ee94102085f87e0 > refs/remotes/origin/master > ./.git/refs/remotes/karmic/HEAD:1:ref: refs/remotes/origin/master > > Change 'origin' to 'karmic' in above files. Ah yes, I forgot about those files. I _think_ (but I'm not certain without digging into the code) that it's always safe to rm packed-refs, as that file is a cache for quicker access to the refs. At least it's never caused me any problems. In any case, your approach of grepping the whole of .git for interesting strings is a good way to learn about the implementation. -- Virus found in this message. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-06 0:07 ` Russell Steicke @ 2010-01-06 0:27 ` Johannes Schindelin 2010-01-07 1:53 ` Russell Steicke 2010-01-06 1:02 ` Junio C Hamano 2010-01-06 3:58 ` Dongas 2 siblings, 1 reply; 14+ messages in thread From: Johannes Schindelin @ 2010-01-06 0:27 UTC (permalink / raw) To: Russell Steicke; +Cc: Dongas, git Hi, On Wed, 6 Jan 2010, Russell Steicke wrote: > On Tue, Jan 5, 2010 at 12:30 PM, Dongas <dongas86@gmail.com> wrote: > > I did a few more steps: > > root@ubuntu:/work/git-repo/free_monkey# grep -wrin 'origin' . > > ./.git/packed-refs:2:abfae429bb4081043e84681e5ee94102085f87e0 > > refs/remotes/origin/master > > ./.git/refs/remotes/karmic/HEAD:1:ref: refs/remotes/origin/master > > > > Change 'origin' to 'karmic' in above files. > > Ah yes, I forgot about those files. I _think_ (but I'm not certain > without digging into the code) that it's always safe to rm > packed-refs, as that file is a cache for quicker access to the refs. For everybody reading this thread: DON'T! Russel, it would be better if you knew about the mechanism before making other people believe that it is safe to delete a file that is _not_ a cache, but _replaces_ the existing refs. (Just mentioning that you only _think_ it is safe does not help; it is not safe, but people will think that it is safe. Maybe you'll spend those 5 minutes in the future before sending a message like you did...) Hth, Dscho ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-06 0:27 ` Johannes Schindelin @ 2010-01-07 1:53 ` Russell Steicke 0 siblings, 0 replies; 14+ messages in thread From: Russell Steicke @ 2010-01-07 1:53 UTC (permalink / raw) To: Johannes Schindelin; +Cc: Dongas, git On Wed, Jan 6, 2010 at 8:27 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > For everybody reading this thread: DON'T! > > Russel, it would be better if you knew about the mechanism before > making other people believe that it is safe to delete a file that is _not_ > a cache, but _replaces_ the existing refs. Thank you for explaining that. I apologise for the misleading information. I have seen refs in packed-refs as duplicates of those in the refs/ tree. How would that come about? -- Virus found in this message. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-06 0:07 ` Russell Steicke 2010-01-06 0:27 ` Johannes Schindelin @ 2010-01-06 1:02 ` Junio C Hamano 2010-01-06 3:58 ` Dongas 2 siblings, 0 replies; 14+ messages in thread From: Junio C Hamano @ 2010-01-06 1:02 UTC (permalink / raw) To: Russell Steicke; +Cc: Dongas, git Russell Steicke <russellsteicke@gmail.com> writes: > Ah yes, I forgot about those files. I _think_ (but I'm not certain > without digging into the code) that it's always safe to rm > packed-refs, as that file is a cache for quicker access to the refs. No what you think is incorrect, no it is not safe at all, and no it is not a cache. refs are created loose as files under $GIT_DIR/refs/. When pack-refs is run (either from the toplevel or as part of gc), these loose ref files are removed and instead written to $GIT_DIR/packed-refs file. When a new ref is created or an existing ref is updated, only $GIT_DIR/refs/ is modified. When reading or enumerating, a loose ref, if found, is used. Otherwise a record in packed-refs is consulted. The consequences are: - If you have $GIT_DIR/refs/heads/master and at the same time, an entry for refs/heads/master exists in $GIT_DIR/packed-refs, removing the entry in packed-refs happens to be safe, because it was already masked. - If you do not have $GIT_DIR/refs/heads/old, but an entry for refs/heads/old exists in $GIT_DIR/packed-refs, removing the entry in packed-refs means you lose the "old" branch. You don't want to do that. - When deleting a ref, we remove it from $GIT_DIR/refs/, but at the same time, if packed-refs contains an entry for it, we remove it from there. Otherwise, the removal of the loose one will unmask the stale entry in packed-refs file. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: A question about changing remote repo name 2010-01-06 0:07 ` Russell Steicke 2010-01-06 0:27 ` Johannes Schindelin 2010-01-06 1:02 ` Junio C Hamano @ 2010-01-06 3:58 ` Dongas 2 siblings, 0 replies; 14+ messages in thread From: Dongas @ 2010-01-06 3:58 UTC (permalink / raw) To: Russell Steicke; +Cc: git 2010/1/6 Russell Steicke <russellsteicke@gmail.com>: > On Tue, Jan 5, 2010 at 12:30 PM, Dongas <dongas86@gmail.com> wrote: >> I did a few more steps: >> root@ubuntu:/work/git-repo/free_monkey# grep -wrin 'origin' . >> ./.git/packed-refs:2:abfae429bb4081043e84681e5ee94102085f87e0 >> refs/remotes/origin/master >> ./.git/refs/remotes/karmic/HEAD:1:ref: refs/remotes/origin/master >> >> Change 'origin' to 'karmic' in above files. > > Ah yes, I forgot about those files. I _think_ (but I'm not certain > without digging into the code) that it's always safe to rm > packed-refs, as that file is a cache for quicker access to the refs. > At least it's never caused me any problems. > > In any case, your approach of grepping the whole of .git for > interesting strings is a good way to learn about the implementation. Thanks a lot for your help. :) Regards Dongas ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-01-07 1:53 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-01-04 6:45 A question about changing remote repo name Dongas 2010-01-04 20:09 ` Miklos Vajna 2010-01-05 1:53 ` Dongas 2010-01-05 1:57 ` Erik Faye-Lund 2010-01-05 2:25 ` Dongas 2010-01-05 2:52 ` Russell Steicke 2010-01-05 4:30 ` Dongas 2010-01-05 21:15 ` David Aguilar 2010-01-06 3:55 ` Dongas 2010-01-06 0:07 ` Russell Steicke 2010-01-06 0:27 ` Johannes Schindelin 2010-01-07 1:53 ` Russell Steicke 2010-01-06 1:02 ` Junio C Hamano 2010-01-06 3:58 ` Dongas
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).