git config --global user.name <name>
git config --global user.email <email>
git config --system core.editor <editor>
git config --global --edit - open global settings
<repo>/.git/config
– Repository-specific settings.
~/.gitconfig
– User-specific settings. This is where options set with the --global
flag are stored.
$(prefix)/etc/gitconfig
– System-wide settings.
git clone <repo> <directory>
git init
git remote add origin https://github.com/user/repo.git
## Stage 0 (Working directory)
#### Undo changes
>```
git revert <commit>
Generate a new commit that undoes all of the changes introduced in <commit>
, then apply it to the current branch. Reverting should be used when you want to remove an entire commit from your project history.
git reset ... TODO
git checkout <master || commit>
> Copy `<file>` from branch/commit to staging area
## Stage 1 (Staging area)
#### Adding files to staging area
git add <file || directory>
>```
git add -p
Interactive patch mode
- y to stage the chunk
- n to ignore the chunk
- s to split it into smaller chunks,
- e to manually edit the chunk
- q to exit
git reset HEAD <file || directory>
Save Files files from Staging area (git will never change them unless explicitly asked to)
git commit
Launches editor to add commit message
#### Resources
[Atlassian git tutorial][0]
[0]: https://www.atlassian.com/git/tutorials/