Gracias al usuario jelcaf
git push origin $rama_actual
git reset --HARD $SHA1
git remote show origin
git fetch origin
git checkout --track -b $rama origin/$rama
- más simple
git checkout -t origin/$rama
git branch -a
- master
- remotes/origin/HEAD -> origin/master
- remotes/origin/baremacion
- remotes/origin/bootstrap
- remotes/origin/fallo_registro
- remotes/origin/master
git checkout -b baremacion remotes/origin/baremacion
git branch $branch
git checkout -b $new_branch $other
git branch -d $branch
git push origin :$branch
git fetch -p
git remote prune origin
git branch -m $nombre_rama_anterior $nombre_rama_nuevo
Ignorar el salto de línea en Git
git config --global core.autocrlf input
git checkout $rama
git cherry-pick $SHA1
git tag
git tag -a v1.2 $SHA1
git push --tags
git reset --soft HEAD~1
git revert HEAD
Subir a la rama Commits parciales (los ficheros que no añado se quedan en el stash y se recuperan luego)
git add $file
git commit -m "Mensaje"
git stash
git pull --rebase origin $rama
git push origin rama
git stash pop
git log origin/master..master
git branch -r --contains $commit
git reset --soft HEAD^
git commit --ammend -m "Nuevo mensaje"
- Deshacer commits
- Unir commits
- Reordenar commits
- ...
git rebase -i HEAD~10 # Esto mira los 10 últimos
- Y veremos algo como esto:
pick ce2b738 Commit message 1
pick 2a3cdf7 Commit message 2
- p, pick = use commit
- r, reword = use commit, but edit the commit message
- e, edit = use commit, but stop for amending
- s, squash = use commit, but meld into previous commit
- f, fixup = like "squash", but discard this commit's log message
- x, exec = run command (the rest of the line) using shell
- Establecer la fecha de los commits anterior al rebase => git committer date = git author date
git filter-branch --env-filter 'GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE; export GIT_COMMITTER_DATE' <sha1>..HEAD
- You need to use the explicit SSH protocol URL syntax for git:
git clone ssh://git@server:2222/repo
- Otra solución Recuperarse de un desastre