Parece que he perdido el trabajo de mi tarde en un nuevo repositorio. Esto es lo que hice:Archivos de escenario, luego agregar de forma remota, luego tirar - y mis archivos se han ido
- Creé un nuevo proyecto localmente e hice algún trabajo.
- Creado un acuerdo de recompra en github
git init
git add src
git remote add origin [email protected]:Synesso/memx.git
git pull origin master
git add .gitignore
git commit -m 'updated ignore'
git push origin master
Tanto mi repositorio local como el repositorio github solo tienen dos compromisos. La confirmación inicial (hecha por github en la creación del proyecto) y una segunda que incluye solo el archivo .gitignore
.
Los archivos agregados en el paso 4 (git add src
) no están presentes. Tampoco parecen ser escenificados.
¿Pierde archivos por etapas cuando hace un git pull
? ¿Puedo recuperarlos de alguna manera?
Estado actual:
$ git status
# On branch master
nothing to commit (working directory clean)
Mi inital add
no está en el reflog.
$ git reflog
c80135d [email protected]{0}: checkout: moving from 999d128ea4e6969f9eacbceebb5f857f2aa5abb0 to master
999d128 [email protected]{1}: checkout: moving from master to HEAD~1
c80135d [email protected]{2}: checkout: moving from 999d128ea4e6969f9eacbceebb5f857f2aa5abb0 to master
999d128 [email protected]{3}: checkout: moving from master to 999d128ea4e6969f9eacbceebb5f857f2aa5abb0
c80135d [email protected]{4}: commit (amend): updated ignore
28b4f90 [email protected]{5}: commit: updated ignore
999d128 [email protected]{6}: initial pull
history
muestra que añadí la carpeta src
, pero no lo cometió:
223 git init
225 git add src
229 git add project/Build.scala
234 git remote add origin [email protected]:Synesso/memx.git
250 git pull origin master
sé git se quejará si intenta tirar con archivos sucios presentes. ¿Pero está bien hacer un tirón que obliterará los archivos escalonados? Eso parece incorrecto
Acabo de volver a probar este proceso y sí, destruye los archivos por etapas.
[email protected]:~/projects$ mkdir x
[email protected]:~/projects$ cd x
[email protected]:~/projects/x$ git init
Initialized empty Git repository in /home/jem/projects/x/.git/
[email protected]:~/projects/x$ echo "hi" > hello.world
[email protected]:~/projects/x$ git add hello.world
[email protected]:~/projects/x$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: hello.world
#
[email protected]:~/projects/x$ ls -asl
total 24
4 drwxrwxr-x 3 jem jem 4096 Apr 28 20:56 .
4 drwxr-xr-x 8 jem jem 4096 Apr 28 20:56 ..
4 drwxrwxr-x 7 jem jem 4096 Apr 28 20:56 .git
12 -rw-rw-r-- 1 jem jem 3 Apr 28 20:56 hello.world
[email protected]:~/projects/x$ git remote add origin [email protected]:Synesso/memx.git
[email protected]:~/projects/x$ git reflog
fatal: bad default revision 'HEAD'
[email protected]:~/projects/x$ git pull origin master
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 0), reused 3 (delta 0)
Unpacking objects: 100% (7/7), done.
From github.com:Synesso/memx
* branch master -> FETCH_HEAD
[email protected]:~/projects/x$ ls -asl
total 36
4 drwxrwxr-x 3 jem jem 4096 Apr 28 20:53 .
4 drwxr-xr-x 8 jem jem 4096 Apr 28 20:52 ..
4 drwxrwxr-x 8 jem jem 4096 Apr 28 20:53 .git
12 -rw-rw-r-- 1 jem jem 59 Apr 28 20:53 .gitignore
12 -rw-rw-r-- 1 jem jem 9 Apr 28 20:53 README.md
[email protected]:~/projects/x$ git reflog
c80135d [email protected]{0}: initial pull
Se eliminó el archivo hello.world
sin previo aviso.
'git reflog' le mostrará las modificaciones de árbol. Pero si nunca cometió sus archivos 'src' ... –
¿Qué dice' git status' ahora? – vissi2