This is an old revision of the document!
/etc/gitconfig (específica del sistema, en windows en el $HOME del usuario)
>git config --system --list
~/.gitconfig o ~/.config/git/config (específicas del usuario)
>git config --global --list
.git/config (específica del repositorio).
>git config --list
Cada uno de estos sobreescribe el comportamiento del anterior en este orden
Valores que se pueden cambiar: user.name, user.email, core.editor
>git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst ..."
>git init
>git clone https://github.com/libgit2/libgt2
se puede especificar el directorio destino con
>git clone https://github.com/libgit2/libgt2 mlibgit
>git add *.c
>git rm --cached README
>git commit -m 'Texto para el commit'
>git status On branch master No commits yet nothing to commit (create/copy files and use "git add" to track)
>echo 'My project' > README >git status On branch master No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) README nothing added to commit but untracked files present (use "git add" to track)
>git add README >git status On branch master No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: README
Suponiendo un fichero CONTRIBUTING.md existe y está comiteado, tras modificarlo lo que saldrá del status es lo siguiente:
>git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: README Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: CONTRIBUTING.md
Tras esto hay que añadirlo al staging para que a continuación salga lo siguiente:
>git add CONTRIBUTING.md >git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: CONTRIBUTING.md new file: README
Si se modifica el fichero CONTRIBUTING.md el resultado del status es el siguiente
>echo "huy" > CONTRIBUTING.md >git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: CONTRIBUTING.md new file: README Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: CONTRIBUTING.md
El fichero que se comitearia sería el primero. Si se quiere comitear el segundo hay que hacer otro git add
git add CONTRIBUTING.md git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: CONTRIBUTING.md new file: README
existe una manera de sacar estos listados de manera abreviada:
>git status --short M CONTRIBUTING.md A README MM fichero1 ?? fichero2 M fichero3
Los ficheros que no se han registrado en el staging aún tienen un ??. Los nuevos ficheros que se han añadido al staging tienen una A, los modificados tienen una M. Además hay dos columnas, la primera o izquierda indica el estado del staging, y la segunda la del working tree. De esta manera el fichero3 está modificado en el working directory pero no está en el staging, mientras que el contriguting.md está modificado en el working tree y está en el staging, mientras que el fichero1 está modificado en el working tree, stageado y vuelvo a modificar sin stagear
>cat .gitignore
Las líneas en blanco o que empiecen por # son ignoradas. Las expresiones regulares se realizan con patrones glob. Los patrones que empiezan por / evitan la recursividad. El resto de / especifican un directorio. La ! niega el patrón
> git diff