git
This is an old revision of the document!
Table of Contents
Git Cheat Sheet
These are the commands that I look up the most to make sure I'm doing them right. Eventually I'll remember them…
Branches
Create a new branch from current changes
This will create the new branch. When the branch is created, it will be active with the changes from the old branch. Switching back to the old branch will no longer show the changes.
$ git checkout -b <new branch>
Create upstream branch from local branch
Commit any local changes then:
$ git push -u origin <new branch>
Delete a local branch
$ git branch -D <branchName> Deleted branch <branchName> (was ....).
Delete a remote branch
$ git push origin --delete <branchName> To git@github.com:<repository>.git - [deleted] <branchName>
Merge
Merge branch into current branch
$ git merge <branch>
git.1466080093.txt.gz · Last modified: 2023/08/18 18:15 (external edit)