Skip to content

Latest commit

 

History

History
317 lines (270 loc) · 22.3 KB

general.md

File metadata and controls

317 lines (270 loc) · 22.3 KB

General

Watchout for

Fun

Theory

Patterns

Management / Productivity

Books

Infrastructure, DevOps

Related

Tools

Markdown

Command Line / Bash / Shell / Terminal

Python

Git

  • Useful Global Git Configurations

  • A Guide To Undoing Mistakes With Git: part 1, part 2

  • Managing your secrets in Git[git-crypt]

  • gitmoji

  • Git Basics: Renaming a Local and Remote Branch

  • How to find the Git commit that introduced a string in any branch?

  • RomuloOliveira/commit-messages-guide

  • Git Checkout at Previous Timeframe

  • Using multiple worktrees with git

  • Sort git Branches by Date

  • Flight rules for git

  • Little Things I Like to Do with Git

  • Conventional Commits

  • Getting solid at Git rebase vs. merge

  • Git - When to Merge vs. When to Rebase

  • How to delete a Git branch both locally and remotely?

  • Git Tools - Credential Storage

  • Caching your GitHub password in Git

  • Is there a way to skip password typing when using https://

  • Bash Shortcuts to Enhance Your Git Workflow

  • Git in 2016

  • A Small Matter of Programming

  • Git bisect

  • Stop using git pull: A better workflow

  • Try Git

  • git - the simple guide

  • Learn Git Branching

  • Cheat Sheet

  • .gitignore files

  • Commit History

  • Interactive Staging

  • Stashing and Cleaning

  • Searching

  • Reset Demystified

  • How to revert a faulty merge

  • Rebase

  • Advanced Merging

  • Rewriting History

  • Revision Selection

  • Distributed Git - Contributing to a Project

  • Distributed Git - Maintaining a Project

  • Some commands

    • git checkout - will checkout the previous branch (shorthand for git checkout @{-1})

    • git rebase master --autostash will stash and reapply stashed stuff after rebase

    • git fetch origin --prune fetches origin end cleans up a bit, removes deleted remote branches but not the checked out ones

    • git config --global rerere.enabled true enable re re re

    • git config --global rerere.autoupdate true enable auto re re re update (add to staged files)

    • git config --global pull.rebase preserve set pull to use rebase with preserve merges option

    • git config --global rebase.autostash true

    • git config --global user.name "John Doe"

    • git config --global user.email johndoe@example.com

    • git config --global core.editor emacs

    • git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -nosession"

    • git config --list list git config in actual dir

    • git config --global --list list git global config

    • git config user.name check user name

    • git config --global credential.helper cache cache https auth temporarily

    • git remote show origin show remote info

    • git tag -l "v1.8.5*" search tags

    • git tag -a v1.4 -m "my version 1.4" create annnotated tag

    • git tag -a v1.2 9fceb02 create annotated tag for prev commit

    • git push origin v1.5 push a single tag

    • git push origin --tags push all tags

    • git checkout -b version2 v2.0.0 "checkout" a tag

    • git ls-remote [origin] shows remote infos

    • git remote show [origin] shows remote detailed infos

    • git push origin serverfix:awesomebranch push to a branch with different name

    • git checkout -b serverfix origin/serverfix checkout remote tracking branch

    • git checkout --track origin/serverfix checkout remote tracking branch shorter

    • git checkout serverfix checkout remote tracking branch, shortest

    • git branch -u origin/serverfix setup local bracnch to track remote

      • git branch --set-upstream-to origin/serverfix setup local bracnch to track remote
    • git merge @{u} can be used instead git merge origin/master

      • git merge @{upstream} can be used instead git merge origin/master
    • git branch -vv check setup remote tracking branches

    • git branch -r --sort=-committerdate --format='%(committerdate) %(refname)' show remote branches ordered by modification date

    • git push origin --delete serverfix delete remote branch serverfix

      • git push origin :serverfix delete remote branch serverfix
    • git pull --rebase pull rebase instead pull merge

    • git log --no-merges check commit message structure/convention

    • git request-pull origin/master myfork create pull request info

    • git format-patch -M origin/master create a patch

    • git apply /tmp/patch-ruby-client.patch apply a patch

    • git am 0001-limit-log-function.patch apply a format-patch patch

    • git update-ref -d HEAD resets the branch to its initial state, eg before the first commit

    • git branch -a --contains <commit> list local + remote branches which contains the specified commit

    • git branch -r --contains <commit> list remote branches which contains the specified commit

    • git branch --contains <commit> list local branches which contains the specified commit

    • git tag --contains <commit> list tags which contains the specified commit

    • git log contrib --not master exclude master commits from log same as master..contrib

    • git diff master...contrib show only the new diffs introduced in contrib, ... -> diff from common ancestor (.. => simple diff)

      • git diff A...B == git diff $(git-merge-base A B) B
      • git diff A..B == git diff A B
    • git log master...experiment all commits which are reachable from master and experiment but not the common ones (eg: common ancestor, ...)

    • git log master..head to check commits what head has but master not, also git rebase master will reapply these commits

    • git diff --name-only rev1..rev2 shows changed files between the specified revisions

    • git diff --name-status rev1..rev2 shows changed files with status info between the specified revisions

    • git rev-list --boundary --date-order development..feature => last -hash is the branch commit as it seems

    • git rev-list --boundary --date-order --graph development..feature => looks useful o represents branch commits ?

    • git rev-list --boundary --date-order development..feature | grep ^- | cut -c2- => first hash is the oldest branch commit as it seems

    • git log --boundary --date-order development..feature => last commit is the branch point

    • git merge-base dev feature shows BEST common ancestor eg. only the last merge base if there were more

    • git show :1:hello.rb > hello.common.rb extract a copy of base version in merge

    • git show :2:hello.rb > hello.ours.rb extract a copy of local version in merge

    • git show :3:hello.rb > hello.theirs.rb extract a copy of remote version in merge

    • git ls-files -u lists the blobs for each version (base/local/remote)

    • git checkout --conflict=diff3 will re-checkout the file again and replace the merge conflict markers

    • git checkout --conflict will re-checkout the file again and replace the merge conflict markers

    • git checkout --ours / --theirs checkouts the specified versions

    • git diff --ours / --theirs / --base shows the diffs between specified and merged version

    • git clean clean/remove untracked/not ignored files (merge temp files, etc.)

    • git clean -f -d clean/remove untracked not/ignored files and empty dirs

    • git clean -d -n check what will be cleaned/removed

    • git filter-branch --tree-filter 'rm -f passwords.txt' HEAD removing a file from every commit

related

Editor/IDE