notes/git.md

29 lines
858 B
Markdown
Raw Normal View History

2018-09-07 17:30:38 -04:00
Branches
============================================
2020-10-29 20:27:17 -04:00
### Adding Branches
2018-09-07 17:30:38 -04:00
* local: `git checkout -b <branch>`
* remote: `git push --set-upstream <remote> <branch>`
* track remote: `git checkout --track <origin>/<branch>`
2020-10-29 20:27:17 -04:00
### Deleting Branches
2018-09-07 17:30:38 -04:00
* local: `git branch -d <name>`
* remote: `git push -d <remote> <name>`
* realize remote deletes: `git remote prune <remote>`
2020-10-29 20:27:17 -04:00
### Non-Standard Activities
2018-09-07 17:30:38 -04:00
* merge only a single file into another branch `git checkout <branch> -- <file>`
* delete from repo and file system `git rm <file>`
2018-09-21 11:47:25 -04:00
* set current branch to track remote `git branch -u <origin>/<branch>`
Config
=============================================
2018-09-26 08:57:17 -04:00
* set line ending behaviour `git config --global core.autocrlf true`
2020-10-29 20:27:17 -04:00
* store credentials `git config credential.helper store` or `git config credential.helper cache`