notes/git.md

40 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

2023-01-12 19:45:43 -05:00
Branches
============================================
### Adding Branches
* local: `git checkout -b <branch>`
* remote: `git push --set-upstream <remote> <branch>`
* track remote: `git checkout --track <origin>/<branch>`
### Deleting Branches
* local: `git branch -d <name>`
* remote: `git push -d <remote> <name>`
* realize remote deletes: `git remote prune <remote>`
### Non-Standard Activities
* merge only a single file into another branch `git checkout <branch> -- <file>`
* delete from repo and file system `git rm <file>`
* set current branch to track remote `git branch -u <origin>/<branch>`
Config
=============================================
* set line ending behaviour `git config --global core.autocrlf true`
this should force git to checkout code using OS default line endings
* store credentials `git config credential.helper store` or `git config credential.helper cache`
2023-02-03 10:51:20 -05:00
.gitignore
================================================
[Git - gitignore Documentation (git-scm.com)](https://git-scm.com/docs/gitignore)
* `.obsidian/` ignores the .obsidian directory
2023-02-03 10:54:37 -05:00
to untrack files `git rm --cached .\.vscode\`