{"thread":{"id":"55628","subject":"[feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","startedAt":"2021-05-05T19:52:00Z","lastAt":"2021-05-06T14:10:41Z","messageCount":16,"participants":["Yuri","Randall S. Becker","Junio C Hamano","Johannes Sixt","Felipe Contreras","Theodore Ts'o"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"423717","messageId":"d8aef355-0718-8b3d-7e9f-614673dd250f@rawbw.com","threadId":"55628","inReplyTo":null,"subject":"[feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Yuri","fromEmail":"yuri@rawbw.com","sentAt":"2021-05-05T19:51:56Z","receivedAt":"2021-05-05T19:52:00Z","isPatch":false,"sender":{"key":"yuri@rawbw.com","avatar":null},"body":"I work in a very large repository, but all of it except for my stashed \nitems can be re-downloaded from the remote URL.\n\n\nStash though is much smaller in size and is especially valuable. Its \nloss would be very expensive.\n\n\nCould you please consider adding 'git stash export', 'git stash import' \ncommands so that in case of an accidental repository loss stash can be \nimported from the external backup?\n\n\nThanks,\n\nYuri\n\n"},{"id":"423718","messageId":"000401d741ea$5227c610$f6775230$@nexbridge.com","threadId":"55628","inReplyTo":"d8aef355-0718-8b3d-7e9f-614673dd250f@rawbw.com","subject":"RE: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2021-05-05T20:07:42Z","receivedAt":"2021-05-05T20:07:59Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On May 5, 2021 3:52 PM, Yuri wrote:\n>Subject: [feature suggestion] Add 'git stash export', 'git stash import' commands\n>to allow to backup stash externally\n>\n>I work in a very large repository, but all of it except for my stashed items can be\n>re-downloaded from the remote URL.\n>\n>\n>Stash though is much smaller in size and is especially valuable. Its\n>loss would be very expensive.\n>\n>\n>Could you please consider adding 'git stash export', 'git stash import'\n>commands so that in case of an accidental repository loss stash can be\n>imported from the external backup?\n\nI would like to suggest another option: Teach clone and fetch to transfer stash commits. They are filtered out normally. It might be straightforward to preserve the stashed commits. A mirror approach is probably not appropriate since that needs the repo to be bare and Yuri's situation is unlikely to support that. So something like --include-stashes, which would be off by default.\n\nAs a side potential defect/bug, if you fetch refs/stash, git is happy to comply and reports the HEAD update and then loses it. git show-refs does not show the stash. What I saw on the fetch was (I only had untracked files in my stash to make things more painful) as follows in 2.29.1:\n\n$ git fetch origin refs/stash\nFrom /path-to-repo\n * branch              refs/stash -> FETCH_HEAD\n\n-Randall\n\n"},{"id":"423719","messageId":"5d162b5b-9bdf-7a33-7bbe-e8caa8012ebc@rawbw.com","threadId":"55628","inReplyTo":"000401d741ea$5227c610$f6775230$@nexbridge.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Yuri","fromEmail":"yuri@rawbw.com","sentAt":"2021-05-05T20:11:38Z","receivedAt":"2021-05-05T20:11:44Z","isPatch":false,"sender":{"key":"yuri@rawbw.com","avatar":null},"body":"On 5/5/21 1:07 PM, Randall S. Becker wrote:\n> I would like to suggest another option: Teach clone and fetch to transfer stash commits\n\nThis would make them public, which is not always desirable.\n\nIMO both options should be implemented.\n\n\nYuri\n\n"},{"id":"423734","messageId":"xmqq1rak1tz3.fsf@gitster.g","threadId":"55628","inReplyTo":"000401d741ea$5227c610$f6775230$@nexbridge.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-06T02:22:56Z","receivedAt":"2021-05-06T02:22:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Randall S. Becker\" <rsbecker@nexbridge.com> writes:\n\n> I would like to suggest another option: Teach clone and fetch to\n> transfer stash commits. They are filtered out normally. It might\n> be straightforward to preserve the stashed commits. A mirror\n> approach is probably not appropriate since that needs the repo to\n> be bare and Yuri's situation is unlikely to support that. So\n> something like --include-stashes, which would be off by default.\n\nIt would unfortunately not work, since stash is not implemented as a\nset of regular refs.  Instead its entries are kept in reflogs.  And\nbecause the reflog is treated as an entierly local matter, reflog\nentries are not transfered across fetches and clones.\n\nIf stash are redesigned so that each of its entry becomes a separate\nref (e.g. refs/stash/0 refs/stash/1 refs/stash/2 ...), then\n\n    git bundle stash.bndl $(git for-each-ref --format='%(refname)' refs/stash/\\*)\n\nmight become the beginning of a viable implementation of \"stash\nexport\" (but note that the above does not list any stopping point of\nthe history traversal, so it is just the beginning and does not make\na practical solution).\n\n"},{"id":"423743","messageId":"fff9baee-ac4e-66ea-1dfb-791a8b044527@kdbg.org","threadId":"55628","inReplyTo":"d8aef355-0718-8b3d-7e9f-614673dd250f@rawbw.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2021-05-06T06:07:41Z","receivedAt":"2021-05-06T06:08:03Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 05.05.21 um 21:51 schrieb Yuri:\n> I work in a very large repository, but all of it except for my stashed\n> items can be re-downloaded from the remote URL.\n> \n> \n> Stash though is much smaller in size and is especially valuable. Its\n> loss would be very expensive.\n\nI would argue that you are doing something wrong if your stashes are\nparticularly valuable. If you regularly revert temporary, but precious\nwork, then you should commit the work and mark it with a branch tip or tag.\n\n> Could you please consider adding 'git stash export', 'git stash import'\n> commands so that in case of an accidental repository loss stash can be\n> imported from the external backup?\n\n-- Hannes\n"},{"id":"423744","messageId":"e75f000b-e376-45d5-ee5a-2a555076a3d9@rawbw.com","threadId":"55628","inReplyTo":"fff9baee-ac4e-66ea-1dfb-791a8b044527@kdbg.org","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Yuri","fromEmail":"yuri@rawbw.com","sentAt":"2021-05-06T06:12:27Z","receivedAt":"2021-05-06T06:12:32Z","isPatch":false,"sender":{"key":"yuri@rawbw.com","avatar":null},"body":"On 5/5/21 11:07 PM, Johannes Sixt wrote:\n> I would argue that you are doing something wrong if your stashes are\n> particularly valuable. If you regularly revert temporary, but precious\n> work, then you should commit the work and mark it with a branch tip or tag.\n>\n\nNo, it is work in progress. I begin to work on some modification or \nupdate, discover some issue, and stash the update until this issue is \nresolved,\n\nIt could take days, weeks, months to resolve them.\n\n\nYuri\n\n"},{"id":"423748","messageId":"35877543-93b8-00f8-692e-09a06d4679aa@kdbg.org","threadId":"55628","inReplyTo":"e75f000b-e376-45d5-ee5a-2a555076a3d9@rawbw.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2021-05-06T06:43:55Z","receivedAt":"2021-05-06T06:44:02Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 06.05.21 um 08:12 schrieb Yuri:\n> On 5/5/21 11:07 PM, Johannes Sixt wrote:\n>> I would argue that you are doing something wrong if your stashes are\n>> particularly valuable. If you regularly revert temporary, but precious\n>> work, then you should commit the work and mark it with a branch tip or\n>> tag.\n>>\n> \n> No, it is work in progress. I begin to work on some modification or\n> update, discover some issue, and stash the update until this issue is\n> resolved,\n> \n> It could take days, weeks, months to resolve them.\n\nI know. But, as I said, when you turn away from your current work, which\nis precious, then you should make a commit, in particular, when you can\nforsee that you might not be able to come back soon.\n\nA 'git stash' is really only intended as a short-term\nmake-the-worktree-temporarily-clean auxiliary storage. It is not\nintended as a long-term storage. For long-term storage, use branches.\n\"Short term\" is measured in seconds (rebase --autostash), minutes,\nperhaps hours, but certainly not weeks or months.\n\nAt least, that's how I understand (and use) it.\n\n-- Hannes\n"},{"id":"423749","messageId":"d4ae27b9-3911-506c-a23c-3ed91bb250d1@rawbw.com","threadId":"55628","inReplyTo":"35877543-93b8-00f8-692e-09a06d4679aa@kdbg.org","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Yuri","fromEmail":"yuri@rawbw.com","sentAt":"2021-05-06T06:58:16Z","receivedAt":"2021-05-06T06:58:24Z","isPatch":false,"sender":{"key":"yuri@rawbw.com","avatar":null},"body":"On 5/5/21 11:43 PM, Johannes Sixt wrote:\n> I know. But, as I said, when you turn away from your current work, which\n> is precious, then you should make a commit, in particular, when you can\n> forsee that you might not be able to come back soon.\n\n\nHow can I commit unfinished work? Commits are public, this would break \nthings.\n\n> For long-term storage, use branches.\n\nBranches are too heavy-weight. They need merging. Sometimes several stash items need to be used together, which makes it inconvenient.\n\nYuri\n\n"},{"id":"423752","messageId":"xmqqbl9oz27g.fsf@gitster.g","threadId":"55628","inReplyTo":"d4ae27b9-3911-506c-a23c-3ed91bb250d1@rawbw.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-06T08:38:43Z","receivedAt":"2021-05-06T08:38:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Yuri <yuri@rawbw.com> writes:\n\n> On 5/5/21 11:43 PM, Johannes Sixt wrote:\n>> I know. But, as I said, when you turn away from your current work, which\n>> is precious, then you should make a commit, in particular, when you can\n>> forsee that you might not be able to come back soon.\n>\n>\n> How can I commit unfinished work? Commits are public, this would break\n> things.\n\nUnlike centralized SCM like SVN and CVS, commits in Git are private\nuntil you make them public by pushing, and you do not allow other\npeople to fetch/pull from the repository you actively work in.  If\nyour commits become public immediately after you make them, perhaps\nthere is a room in your workflow for vast improvement.\n\n"},{"id":"423753","messageId":"6093ab6bd3ea8_24e620862@natae.notmuch","threadId":"55628","inReplyTo":"d4ae27b9-3911-506c-a23c-3ed91bb250d1@rawbw.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2021-05-06T08:40:11Z","receivedAt":"2021-05-06T08:40:16Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Yuri wrote:\n> On 5/5/21 11:43 PM, Johannes Sixt wrote:\n> > I know. But, as I said, when you turn away from your current work, which\n> > is precious, then you should make a commit, in particular, when you can\n> > forsee that you might not be able to come back soon.\n> \n> How can I commit unfinished work?\n\nJust like that: `git commit`.\n\nThat's what you are doing anyway, whether you realize or not.\n\n> Commits are public, this would break things.\n\nNo. Commits are most definitely not public. Not unless you do\n`git push`, and only if you push to a public repository.\n\nI have countless commits on local branches that nobody would every see.\nMany on a \"tmp\" branch.\n\nI also have many private repositories, which contain passwords and other\nsensitive information. Again... Only for my eyes.\n\n> > For long-term storage, use branches.\n> \n> Branches are too heavy-weight.\n\nNo, each one is a single file consisting of 41 bytes.\n\nA single stash takes about 200 bytes. Considerably more.\n\nCompare:\n\n * .git/refs/heads/master\n * .git/logs/refs/stash\n\n> They need merging. Sometimes several stash items need to be used\n> together, which makes it inconvenient.\n\nYou mean like one stash item goes on top of another?\n\nLike... Commits on a branch?\n\n\nI think this boils down to a confussion of concepts. Stash items are\ncommits. The only real conceptual difference is that you did not\nspecify the message (-m tmp would do that trick).\n\nAgain. Check yourself; the commit is there:\n\n * git cat-file -p stash@{0}\n * git cat-file -p master\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"423754","messageId":"f1bf3086-8c89-f0af-c0c7-f427a935771f@rawbw.com","threadId":"55628","inReplyTo":"xmqqbl9oz27g.fsf@gitster.g","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Yuri","fromEmail":"yuri@rawbw.com","sentAt":"2021-05-06T08:41:13Z","receivedAt":"2021-05-06T08:41:21Z","isPatch":false,"sender":{"key":"yuri@rawbw.com","avatar":null},"body":"On 5/6/21 1:38 AM, Junio C Hamano wrote:\n> Unlike centralized SCM like SVN and CVS, commits in Git are private\n> until you make them public by pushing, and you do not allow other\n> people to fetch/pull from the repository you actively work in.  If\n> your commits become public immediately after you make them, perhaps\n> there is a room in your workflow for vast improvement.\n\n\nLet's say I make commit1, commit2, commit3 and then commit4.\n\n\nHow can I push only commit1 and commit3, but not commit2 and commit4?\n\n\nCan I permanently hold some commits from being pushed while pushing others?\n\n\nYuri\n\n\n"},{"id":"423756","messageId":"8c802d6a-3cba-4c10-0430-0dbf95a56760@rawbw.com","threadId":"55628","inReplyTo":"6093ab6bd3ea8_24e620862@natae.notmuch","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Yuri","fromEmail":"yuri@rawbw.com","sentAt":"2021-05-06T08:45:41Z","receivedAt":"2021-05-06T08:45:49Z","isPatch":false,"sender":{"key":"yuri@rawbw.com","avatar":null},"body":"On 5/6/21 1:40 AM, Felipe Contreras wrote:\n> No. Commits are most definitely not public. Not unless you do\n> `git push`, and only if you push to a public repository.\n>\n> I have countless commits on local branches that nobody would every see.\n> Many on a \"tmp\" branch.\n\n\nSo you advocate to use branches? If branches are same or better than \nstash, why was the stash feature created?\n\nMaybe it should be removed in favor of branches?\n\n\nYuri\n\n\n"},{"id":"423760","messageId":"xmqqy2csxm7n.fsf@gitster.g","threadId":"55628","inReplyTo":"f1bf3086-8c89-f0af-c0c7-f427a935771f@rawbw.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-06T09:09:32Z","receivedAt":"2021-05-06T09:09:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Yuri <yuri@rawbw.com> writes:\n\n> On 5/6/21 1:38 AM, Junio C Hamano wrote:\n>> Unlike centralized SCM like SVN and CVS, commits in Git are private\n>> until you make them public by pushing, and you do not allow other\n>> people to fetch/pull from the repository you actively work in.  If\n>> your commits become public immediately after you make them, perhaps\n>> there is a room in your workflow for vast improvement.\n>\n>\n> Let's say I make commit1, commit2, commit3 and then commit4.\n>\n>\n> How can I push only commit1 and commit3, but not commit2 and commit4?\n\nYou don't.\n\n> Can I permanently hold some commits from being pushed while pushing others?\n\nYes, you arrange these unrelated things (e.g. if commit1 and commit3\ncan become ready to be used without commit2 and commit4, there is\n*no* reason to build commit2 as a direct child of commit1 *AND*\nbuild commit3 as a direct child of commit2) into multiple branches,\nkeep unrelated things separate and related things together, and push\nthe branch commit1 & commit3 are on (obviously in your example they\nbecome ready to be consumed together while commit2 or commit4 are\nnot, so they wouldn't be on the same commit as commit2 or commit4).\n"},{"id":"423765","messageId":"6093c38b7ca62_325720884@natae.notmuch","threadId":"55628","inReplyTo":"f1bf3086-8c89-f0af-c0c7-f427a935771f@rawbw.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2021-05-06T10:23:07Z","receivedAt":"2021-05-06T10:23:12Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Yuri wrote:\n> On 5/6/21 1:38 AM, Junio C Hamano wrote:\n> > Unlike centralized SCM like SVN and CVS, commits in Git are private\n> > until you make them public by pushing, and you do not allow other\n> > people to fetch/pull from the repository you actively work in.  If\n> > your commits become public immediately after you make them, perhaps\n> > there is a room in your workflow for vast improvement.\n> \n> Let's say I make commit1, commit2, commit3 and then commit4.\n> \n> How can I push only commit1 and commit3, but not commit2 and commit4?\n\nYou create a separate branch \"for-upstream\" based on the parent of\ncommit 1.\n\nThen you chery-pick commit 1 and commit 3.\n\nYou can leave the other branch as-is, and deal with that later, or you\ncan rebaste that temporary branch on top of \"for-upstream\".\n\nOr you can rebase first, create a new branch from tmp~2, and then push\nit.\n\n> Can I permanently hold some commits from being pushed while pushing\n> others?\n\nYes.\n\n-- \nFelipe Contreras\n"},{"id":"423767","messageId":"6093c8b236630_32572086a@natae.notmuch","threadId":"55628","inReplyTo":"8c802d6a-3cba-4c10-0430-0dbf95a56760@rawbw.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2021-05-06T10:45:06Z","receivedAt":"2021-05-06T10:45:14Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Yuri wrote:\n> On 5/6/21 1:40 AM, Felipe Contreras wrote:\n> > No. Commits are most definitely not public. Not unless you do\n> > `git push`, and only if you push to a public repository.\n> >\n> > I have countless commits on local branches that nobody would every see.\n> > Many on a \"tmp\" branch.\n> \n> So you advocate to use branches? If branches are same or better than \n> stash, why was the stash feature created?\n\nBranches are for long-term sequences of useful commits.\n\nStashes are for short-term crappy commits.\n\nThey serve a different purpose.\n\n-- \nFelipe Contreras\n"},{"id":"423776","messageId":"YJP40YnfqTpKB9H/@mit.edu","threadId":"55628","inReplyTo":"8c802d6a-3cba-4c10-0430-0dbf95a56760@rawbw.com","subject":"Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally","fromName":"Theodore Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2021-05-06T14:10:25Z","receivedAt":"2021-05-06T14:10:41Z","isPatch":false,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Thu, May 06, 2021 at 01:45:41AM -0700, Yuri wrote:\n> \n> So you advocate to use branches? If branches are same or better than stash,\n> why was the stash feature created?\n> \n> Maybe it should be removed in favor of branches?\n\nStash is actually *implemented* in terms of a branch and reflogs.\nIt's syntactic sugar --- a user interface --- for a simple use case,\nwhich is designed for use by users who don't care to learn a richer,\nmore complex set of commands, or who want to use for simple, temporary\nuse cases.\n\nSo you can see the top-most stash by running the command:\n\n   git log refs/stash\n\nYou can also see that these two commands produce essentially the same\noutput:\n\n   git stash list\n   git reflog refs/stash\n\nBy the way, reflogs by default expire after 90 days.  And if you do\nsomething like this:\n\n  git reflog expire --expire=now --all\n  git stash list\n\n*Poof* Watch all of your stashed patches disappear.  So if you are\nstoring things that you consider especially valuable using git stash,\nI'd encourage you to rethink your strategy.\n\nFor anything that needs to be saved more than a few minutes, I tend to\ncreate explicit branches, which can be named, so it's obvious is going\non.  Those branches aren't pushed out publically by default, any more\nthan the branch refs/stash is pushed out publically.  But because they\nare branches, you can push them out explicitly, perhaps to a private\nremote repo, if you like.\n\nYou can then use git cherry-pick, git rebase, git rebase -i, git\ncommit --amend, etc., to manage your work in progress.  This gives\nmuch finer-grained control over how you manage your in-progress work,\nat the cost of needing to learn a more complex set of commands.\n\nCheers,\n\n\t\t\t\t\t- Ted\n\nP.S.  One hint: if the reason why you don't like using explicit branches is\nbecause you get confused what branch you are on, it's helpful to put\nyour current branch on shell prompt.  I do something like this:\n\n<tytso@cwcc> {/usr/projects/e2fsprogs/e2fsprogs}   (next)\n1822% git checkout tt/pfsck\nSwitched to branch 'tt/pfsck'\n<tytso@cwcc> {/usr/projects/e2fsprogs/e2fsprogs}   (tt/pfsck)\n1823%\n\nOne of the conventions I use is that [initials]/* for branch names\nthat are generally never pushed out.  \"tt\" is my own initials, for my\nown work.  Other people's initials are used for when they send me\nbranches to look at, that aren't quite ready to be merged into the\nmaster, next, or maint branches.  Sometimes I will follow Junio's\nconvention of merging other people's in-progress work that they've\nsent me into a pu (proposed updates) branch, for other people to test\nand review, and for integration testing.  I tend not to do that often\nsince e2fsprogs' development tends not to be as complex/dynamic as\ngit's.\n\n\nMy shell prompt is accomplished through this in my .bashrc:\n\n    if [ $UID = 0 ]; then\n\tu=\"${LOGNAME}.root\"\n\tp=\"#\"\n    else\n\tu=\"$LOGNAME\";\n\tp=\"%\"\n    fi\n    if [ $SHLVL != 1 ]; then\n\ts=\", level $SHLVL\"\n    fi\n    h=${HOSTNAME}\n    if [ -n \"$debian_chroot\" ]; then\n\th=${debian_chroot}-CHROOT.${h}\n    fi\n    if test -f /etc/bash_completion ; then\n\t. /etc/bash_completion\n    fi\n    if test -f /usr/local/share/bash-completion/bash_completion.sh ; then\n\t. /usr/local/share/bash-completion/bash_completion.sh\n    fi\n    if test -f /usr/local/share/git-core/contrib/completion/git-prompt.sh ; then\n\t. /usr/local/share/git-core/contrib/completion/git-prompt.sh\n    fi\n    if type __git_ps1 >& /dev/null ; then\n\tPS1=\"<${u}@${h}> {\\${PWD}}$s  \\$(__git_ps1)\\n\\!$p \"\n    else\n\tPS1=\"<${u}@${h}> {\\${PWD}}$s\\n\\!$p \"\n    fi\n    unset u s h\n"}]}