(→Borrando archivos y enmendando el último commit) |
(→Eliminando archivos de la historia de Git (no hacer a menos que se justifique)) |
||
Línea 110: | Línea 110: | ||
http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History | http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History | ||
+ | ===Crear branches nuevos y vacíos=== | ||
+ | Por ejemplo pueden ser útiles para las gh-pages de GitHub: | ||
+ | <source lang="bash"> | ||
+ | git checkout --orphan NUEVO_BRANCH | ||
+ | git rm -rf . | ||
+ | </source> | ||
+ | |||
+ | * [http://bitflop.com/document/116 How to Create a New and Empty Branch in Git (bitflop.com)] | ||
===Eliminando archivos de la historia de Git (no hacer a menos que se justifique)=== | ===Eliminando archivos de la historia de Git (no hacer a menos que se justifique)=== | ||
* https://help.github.com/articles/remove-sensitive-data | * https://help.github.com/articles/remove-sensitive-data |
git config --global user.name "Pipo Perez" git config --global user.email "pperez@servidor.com" # Un mail que se pueda publicar git config --global color.ui auto git config --global core.editor vim git config --global alias.lol 'log --graph --decorate --pretty=oneline --abbrev-commit' git config --global alias.lola 'log --graph --decorate --pretty=oneline --abbrev-commit --all --date=local' git config --global alias.unstage 'reset HEAD --'
mkdir foobar cd foobar git init
git add archivo git rm archivo
git add archivo
git status git commit -m "Comentario"
git clean -f
Para archivos untracked incluyendo los que estén en .gitignore:
git clean -f -x
git reset HEAD -- <archivo>
o si se definió el alias unstage como se ve arriba:
git unstage <archivo>
git checkout -- <archivo>
git commit --amend
git commit --amend --author "Nombre Apellido <napellido@email.com>"
git reset --hard HEAD~1 git push --force origin HEAD
git remote add origin
git push origin master
git pull origin master
git push --set-upstream origin master git push -u origin master
git push --all git push --tags
git push --mirror
git push --delete nombre_branch git push :nombre_branch
git diff HEAD~1 # Commit padre git diff HEAD~2 # Commit padre del commit padre git diff HEAD^1 # Commit de un padre (para merges) git diff HEAD^2 # Commit de otro padre (para merges)
git log --graph --decorate
git blame archivo
git whatchanged
http://git-scm.com/docs/gitrevisions.html
http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History
Por ejemplo pueden ser útiles para las gh-pages de GitHub:
git checkout --orphan NUEVO_BRANCH git rm -rf .
Haciendo que la historia sea lineal, corrigiendo comentarios de commits, etc...