Of all my git habits, these are by far the most common. Oddly and despite mostly using IntelliJ IDEA where there are already sophisticated GUI interfaces, I use the command line 99% of the time because, uh, habit.
| Command | Notes |
|---|---|
| git clone [email protected]:windofkeltia/project-name.git | clone a (GitLab/GitHub/Bitbucket/etc.) repository locally |
| git checkout -b branchname | create new branch and switch to its local repository |
| git fetch, git pull | latest from branch's remote repository |
| gvim (or IntelliJ IDEA) filename | edit, make changes to filename |
| git status | observe current repository's status, list of changed files |
| git diff filename | examine diff of changes to filename before committing |
| git add filename [ filenames ] | file or files to list of files published, ready to commit to local repository |
| git commit -m "message" | commit all published files to local repository |
| git commit -m "message" filepath | commit only filepath to local repository |
| git commit --amend -m "message" | amend the last commit (if not pushed) |
| git log --name-only | status of committed files, only filepaths |
| git log --name-status | status of committed files including filepaths |
| git log --stat | status of committed files including filepaths and commit information |
| git push | push to remote repository, good back-up strategy |
| git branch | list branches |
| git diff branchname | differences between branchname and current branch |
| git fetch | download changes from remote into local repository |
| git pull | download changes from remote into local repository and merge |
| git merge branchname | merge branchname into current branch |
| git merge branchname | merge branchname into current branch |
| git branch --merged | lists branches merged into HEAD of tip |
| git branch --merged main | lists branches merged into main |
| git branch --merged main | lists branches not yet merged |
| git branch --delete branchname | remove unneeded repository; won't delete if unpushed changes |
| git branch --delete --force branchname | when git pushes back, but you're certain or don't care |
| Command | Notes |
|---|---|
|
gvim (or IntelliJ IDEA) path-to-file-with-conflict git add path-to-corrected-file |
to resolve merge conflict... |