Git Notes
Still to document
- PRs (https://www.git-scm.com/docs/git-request-pull)
- Conflict resolution
- Squashing
- Options during an interactive rebaseCommands
Useful Resources
Git learning game: https://learngitbranching.js.org
Useful commands for fixing mistakes: https://ohshitgit.com
Connecting to GitHub
Logging in to GitHub on the command line: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
Use a personal access token instead of a password
View stored credentials (plain text)
vim ~/.git-credentials
Git Configuration Settings
View/edit git configuration settings
If there's nothing there already this will create a new file
Add this to the
[alias]sectionPretty view of commit tree for current branch
Then run the commands
Git Temp Patch
A great way to get all the changes from a branch and see them on another branch
1. Make sure you're on your feature branch
git checkout your-branch
2. Create a patch of all changes since main (as a diff)
git diff main > temp.patch
3. Checkout main and pull latest
git checkout main git pull origin main
4. Apply the patch (this makes the changes uncommitted on main)
git apply temp.patch
Last updated