3 homepage: https://git-scm.com
5 git: --fast-version-control
8 To update or switch versions, run `webi git@stable` (or `@v2.30`, `@beta`, etc).
12 > Git is a fast, scalable, distributed revision control system with an unusually
13 > rich command set that provides both high-level operations and full access to
16 Github's [Git 'Hello World'](https://guides.github.com/activities/hello-world/)
17 is a good place to get started if you're new to git.
19 ### How to commit files
22 git add ./path/to/file1
23 git add ./path/to/file2
24 git commit -m "my summary for this commit"
27 ### How to ignore common files
29 In your project repository create a `.gitignore` file with patterns of fies to
39 ### How to create a branch
41 This will branch from the branch you're currently on.
44 git checkout -b my-branch-name
47 ### How to rebase by default
50 git config --global pull.rebase true
55 > To "rebase" simply means to undo any of your changes, apply updates from
56 > another branch first, and then replay your changes.
58 Rebase when fetching new updates
61 git pull --rebase origin master
64 Rebase a feature branch from master before a merge
72 # go back to your feature branch
73 git checkout my-feature
78 # fix conflicts if you need to, and then continue
79 git add ./my-merged-file
83 ### How to authenticate git with deploy tokens
86 [The Vanilla DevOps Git Credentials & Private Packages Cheatsheet](https://coolaj86.com/articles/vanilla-devops-git-credentials-cheatsheet/):
88 First, update `.gitconfig` to handle each type of git URL (git, ssh, and http)
92 git config --global url."https://api@github.com/".insteadOf "https://github.com/"
93 git config --global url."https://ssh@github.com/".insteadOf "ssh://git@github.com/"
94 git config --global url."https://git@github.com/".insteadOf "git@github.com:"
97 Next, create a `.git-askpass`:
100 echo 'echo $MY_GIT_TOKEN' > $HOME/.git-askpass
101 chmod +x $HOME/.git-askpass
104 Finally, add the following ENVs to your deployment environment:
107 GIT_ASKPASS=$HOME/.git-askpass
109 # Relpace xxxx... with your deploy token
110 MY_GIT_TOKEN=xxxxxxxxxxxxxxxx
113 In the case of Github it may be useful to create a read-only deploy user for
116 This can work with Docker, Github, Gitlab, Gitea, CircleCI, and many more.