Guest User

Untitled

a guest
Sep 14th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. Stage files, then remote add, then pull - and my files are gone
  2. $ git status
  3. # On branch master
  4. nothing to commit (working directory clean)
  5.  
  6. $ git reflog
  7. c80135d HEAD@{0}: checkout: moving from 999d128ea4e6969f9eacbceebb5f857f2aa5abb0 to master
  8. 999d128 HEAD@{1}: checkout: moving from master to HEAD~1
  9. c80135d HEAD@{2}: checkout: moving from 999d128ea4e6969f9eacbceebb5f857f2aa5abb0 to master
  10. 999d128 HEAD@{3}: checkout: moving from master to 999d128ea4e6969f9eacbceebb5f857f2aa5abb0
  11. c80135d HEAD@{4}: commit (amend): updated ignore
  12. 28b4f90 HEAD@{5}: commit: updated ignore
  13. 999d128 HEAD@{6}: initial pull
  14.  
  15. 223 git init
  16. 225 git add src
  17. 229 git add project/Build.scala
  18. 234 git remote add origin git@github.com:Synesso/memx.git
  19. 250 git pull origin master
  20.  
  21. jem@jem-usb:~/projects$ mkdir x
  22. jem@jem-usb:~/projects$ cd x
  23. jem@jem-usb:~/projects/x$ git init
  24. Initialized empty Git repository in /home/jem/projects/x/.git/
  25. jem@jem-usb:~/projects/x$ echo "hi" > hello.world
  26. jem@jem-usb:~/projects/x$ git add hello.world
  27. jem@jem-usb:~/projects/x$ git status
  28. # On branch master
  29. #
  30. # Initial commit
  31. #
  32. # Changes to be committed:
  33. # (use "git rm --cached <file>..." to unstage)
  34. #
  35. # new file: hello.world
  36. #
  37. jem@jem-usb:~/projects/x$ ls -asl
  38. total 24
  39. 4 drwxrwxr-x 3 jem jem 4096 Apr 28 20:56 .
  40. 4 drwxr-xr-x 8 jem jem 4096 Apr 28 20:56 ..
  41. 4 drwxrwxr-x 7 jem jem 4096 Apr 28 20:56 .git
  42. 12 -rw-rw-r-- 1 jem jem 3 Apr 28 20:56 hello.world
  43. jem@jem-usb:~/projects/x$ git remote add origin git@github.com:Synesso/memx.git
  44. jem@jem-usb:~/projects/x$ git reflog
  45. fatal: bad default revision 'HEAD'
  46. jem@jem-usb:~/projects/x$ git pull origin master
  47. remote: Counting objects: 7, done.
  48. remote: Compressing objects: 100% (5/5), done.
  49. remote: Total 7 (delta 0), reused 3 (delta 0)
  50. Unpacking objects: 100% (7/7), done.
  51. From github.com:Synesso/memx
  52. * branch master -> FETCH_HEAD
  53. jem@jem-usb:~/projects/x$ ls -asl
  54. total 36
  55. 4 drwxrwxr-x 3 jem jem 4096 Apr 28 20:53 .
  56. 4 drwxr-xr-x 8 jem jem 4096 Apr 28 20:52 ..
  57. 4 drwxrwxr-x 8 jem jem 4096 Apr 28 20:53 .git
  58. 12 -rw-rw-r-- 1 jem jem 59 Apr 28 20:53 .gitignore
  59. 12 -rw-rw-r-- 1 jem jem 9 Apr 28 20:53 README.md
  60. jem@jem-usb:~/projects/x$ git reflog
  61. c80135d HEAD@{0}: initial pull
  62.  
  63. hostB$ cd /tmp; mkdir repo; cd repo; git init
  64. Initialized empty Git repository in /tmp/repo/.git/
  65. hostB$ : > .gitignore; echo this is a readme > README.md
  66. hostB$ git add .; git commit -m initial
  67. [master (root-commit) 58d43bd] initial
  68. 1 files changed, 1 insertions(+), 0 deletions(-)
  69. create mode 100644 .gitignore
  70. create mode 100644 README.md
  71.  
  72. hostA$ cd /tmp; mkdir repo; cd repo; git init
  73. Initialized empty Git repository in /tmp/repo/.git/
  74. hostA$ echo hi > hello.world
  75. hostA$ git add hello.world
  76. hostA$ git status
  77. # On branch master
  78. #
  79. # Initial commit
  80. #
  81. # Changes to be committed:
  82. # (use "git rm --cached <file>..." to unstage)
  83. #
  84. # new file: hello.world
  85. #
  86. hostA$ git remote add origin ssh://hostB.dom.ain/tmp/repo
  87. hostA$ git pull origin master
  88. remote: Counting objects: 4, done.
  89. remote: Compressing objects: 100% (2/2), done.
  90. remote: Total 4 (delta 0), reused 0 (delta 0)
  91. Unpacking objects: 100% (4/4), done.
  92. From ssh://hostB.dom.ain/tmp/repo
  93. * branch master -> FETCH_HEAD
  94. hostA$ ls
  95. README.md
  96.  
  97. hostA$ git fsck --lost-found
  98. Checking object directories: 100% (256/256), done.
  99. dangling blob 45b983be36b73c0788dc9cbcb76cbb80fc7bb057
  100. hostA$
  101.  
  102. git init; echo "Readme" > Readme; git add Readme; git commit -m 'Initial commit'
  103.  
  104. git-pull.sh | 3 +++
  105. 1 file changed, 3 insertions(+)
  106.  
  107. diff --git a/git-pull.sh b/git-pull.sh
  108. index 2a10047..da102d0 100755
  109. --- a/git-pull.sh
  110. +++ b/git-pull.sh
  111. @@ -261,6 +261,9 @@ esac
  112.  
  113. if test -z "$orig_head"
  114. then
  115. + test $(git ls-files | wc -l) = 0 ||
  116. + die "$(gettext "Uncommitted changes in the index")"
  117. +
  118. git update-ref -m "initial pull" HEAD $merge_head "$curr_head" &&
  119. git read-tree -m -u HEAD || exit 1
  120. exit
Add Comment
Please, Sign In to add comment