diff --git a/README.md b/README.md index d766842..692c4ca 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ * [Commits in Branch1 that are not in Branch2](https://github.com/git-tips/tips#commits-in-branch1-that-are-not-in-branch2) * [reuse recorded resolution, record and reuse previous conflicts resolutions.](https://github.com/git-tips/tips#reuse-recorded-resolution-record-and-reuse-previous-conflicts-resolutions) * [Open all conflicted files in an editor.](https://github.com/git-tips/tips#open-all-conflicted-files-in-an-editor) +* [Count unpacked number of objects and their disk consumption.](https://github.com/git-tips/tips#count-unpacked-number-of-objects-and-their-disk-consumption) @@ -607,7 +608,7 @@ git rebase -i --autosquash ## skip staging area during commit. ```sh -git commit -am 'commit message' +git commit -am ``` ## List ignored files. @@ -635,5 +636,10 @@ git config --global rerere.enabled 1 git diff --name-only | uniq | xargs $EDITOR ``` +## Count unpacked number of objects and their disk consumption. +```sh +git count-objects --human-readable +``` + diff --git a/tips.json b/tips.json index 03283a2..5e12dcb 100644 --- a/tips.json +++ b/tips.json @@ -1,284 +1,287 @@ [{ - "title": "Everyday Git in twenty commands or so", - "tip": "git help everyday" + "title": "Everyday Git in twenty commands or so", + "tip": "git help everyday" }, { - "title": "Show helpful guides that come with Git", - "tip": "git help -g" + "title": "Show helpful guides that come with Git", + "tip": "git help -g" }, { - "title": "Overwrite pull", - "tip": "git fetch --all && git reset --hard origin/master" + "title": "Overwrite pull", + "tip": "git fetch --all && git reset --hard origin/master" }, { - "title": "List of all files till a commit", - "tip": "git ls-tree --name-only -r " + "title": "List of all files till a commit", + "tip": "git ls-tree --name-only -r " }, { - "title": "Git reset first commit", - "tip": "git update-ref -d HEAD" + "title": "Git reset first commit", + "tip": "git update-ref -d HEAD" }, { - "title": "List all the conflicted files", - "tip": "git diff --name-only --diff-filter=U" + "title": "List all the conflicted files", + "tip": "git diff --name-only --diff-filter=U" }, { - "title": "List of all files changed in a commit", - "tip": "git diff-tree --no-commit-id --name-only -r " + "title": "List of all files changed in a commit", + "tip": "git diff-tree --no-commit-id --name-only -r " }, { - "title": "Unstaged changes since last commit", - "tip": "git diff" + "title": "Unstaged changes since last commit", + "tip": "git diff" }, { - "title": "Changes staged for commit", - "tip": "git diff --cached" + "title": "Changes staged for commit", + "tip": "git diff --cached" }, { - "title": "Show both staged and unstaged changes", - "tip": "git diff HEAD" + "title": "Show both staged and unstaged changes", + "tip": "git diff HEAD" }, { - "title": "List all branches that are already merged into master", - "tip": "git checkout master && git branch --merged" + "title": "List all branches that are already merged into master", + "tip": "git checkout master && git branch --merged" }, { - "title": "Quickly switch to the previous branch", - "tip": "git checkout -" + "title": "Quickly switch to the previous branch", + "tip": "git checkout -" }, { - "title": "Remove branches that have already been merged with master", - "tip": "git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" + "title": "Remove branches that have already been merged with master", + "tip": "git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" }, { - "title": "List all branches and their upstreams, as well as last commit on branch", - "tip": "git branch -vv" + "title": "List all branches and their upstreams, as well as last commit on branch", + "tip": "git branch -vv" }, { - "title": "Track upstream branch", - "tip": "git branch -u origin/mybranch" + "title": "Track upstream branch", + "tip": "git branch -u origin/mybranch" }, { - "title": "Delete local branch", - "tip": "git branch -d " + "title": "Delete local branch", + "tip": "git branch -d " }, { - "title": "Delete remote branch", - "tip": "git push origin --delete ", - "alternatives": ["git push origin :"] + "title": "Delete remote branch", + "tip": "git push origin --delete ", + "alternatives": ["git push origin :"] }, { - "title": "Undo local changes with the last content in head", - "tip": "git checkout -- " + "title": "Undo local changes with the last content in head", + "tip": "git checkout -- " }, { - "title": "Revert: Undo a commit by creating a new commit", - "tip": "git revert " + "title": "Revert: Undo a commit by creating a new commit", + "tip": "git revert " }, { - "title": "Reset: Discard commits, advised for private branch", - "tip": "git reset " + "title": "Reset: Discard commits, advised for private branch", + "tip": "git reset " }, { - "title": "Reword the previous commit message", - "tip": "git commit -v --amend" + "title": "Reword the previous commit message", + "tip": "git commit -v --amend" }, { - "title": "Amend author.", - "tip": "git commit --amend --author='Author Name '" + "title": "Amend author.", + "tip": "git commit --amend --author='Author Name '" }, { - "title": "Reset author, after author has been changed in the global config.", - "tip": "git commit --amend --reset-author --no-edit" + "title": "Reset author, after author has been changed in the global config.", + "tip": "git commit --amend --reset-author --no-edit" }, { - "title": "Changing a remote's URL", - "tip": "git remote set-url origin " + "title": "Changing a remote's URL", + "tip": "git remote set-url origin " }, { - "title": "Get list of all remote references", - "tip": "git remote", - "alternatives": ["git remote show"] + "title": "Get list of all remote references", + "tip": "git remote", + "alternatives": ["git remote show"] }, { - "title": "Get list of all local and remote branches", - "tip": "git branch -a" + "title": "Get list of all local and remote branches", + "tip": "git branch -a" }, { - "title": "Get only remote branches", - "tip": "git branch -r" + "title": "Get only remote branches", + "tip": "git branch -r" }, { - "title": "Stage parts of a changed file, instead of the entire file", - "tip": "git add -p" + "title": "Stage parts of a changed file, instead of the entire file", + "tip": "git add -p" }, { - "title": "Get git bash completion", - "tip": "curl http://git.io/vfhol > ~/.git-completion.bash && echo '[ -f ~/.git-completion.bash ] && . ~/.git-completion.bash' >> ~/.bashrc" + "title": "Get git bash completion", + "tip": "curl http://git.io/vfhol > ~/.git-completion.bash && echo '[ -f ~/.git-completion.bash ] && . ~/.git-completion.bash' >> ~/.bashrc" }, { - "title": "What changed since two weeks?", - "tip": "git whatchanged --since='2 weeks ago'" + "title": "What changed since two weeks?", + "tip": "git whatchanged --since='2 weeks ago'" }, { - "title": "See all commits made since forking from master", - "tip": "git log --no-merges --stat --reverse master.." + "title": "See all commits made since forking from master", + "tip": "git log --no-merges --stat --reverse master.." }, { - "title": "Pick commits across branches using cherry-pick", - "tip": "git checkout && cherry-pick " + "title": "Pick commits across branches using cherry-pick", + "tip": "git checkout && cherry-pick " }, { - "title": "Find out branches containing commit-hash", - "tip": "git branch -a --contains ", - "alternatives": ["git branch --contains "] + "title": "Find out branches containing commit-hash", + "tip": "git branch -a --contains ", + "alternatives": ["git branch --contains "] }, { - "title": "Git Aliases", - "tip": "git config --global alias. \ngit config --global alias.st status" + "title": "Git Aliases", + "tip": "git config --global alias. \ngit config --global alias.st status" }, { - "title": "Saving current state of tracked files without commiting", - "tip": "git stash", - "alternatives": ["git stash save"] + "title": "Saving current state of tracked files without commiting", + "tip": "git stash", + "alternatives": ["git stash save"] }, { - "title": "Saving current state including untracked files", - "tip": "git stash save -u", - "alternatives": ["git stash save --include-untracked"] + "title": "Saving current state including untracked files", + "tip": "git stash save -u", + "alternatives": ["git stash save --include-untracked"] }, { - "title": "Show list of all saved stashes", - "tip": "git stash list" + "title": "Show list of all saved stashes", + "tip": "git stash list" }, { - "title": "Apply any stash without deleting from the stashed list", - "tip": "git stash apply " + "title": "Apply any stash without deleting from the stashed list", + "tip": "git stash apply " }, { - "title": "Apply last stashed state and delete it from stashed list", - "tip": "git stash pop", - "alternatives": ["git stash apply stash@{0} && git stash drop stash@{0}"] + "title": "Apply last stashed state and delete it from stashed list", + "tip": "git stash pop", + "alternatives": ["git stash apply stash@{0} && git stash drop stash@{0}"] }, { - "title": "Delete all stored stashes", - "tip": "git stash clear", - "alternatives": ["git stash drop "] + "title": "Delete all stored stashes", + "tip": "git stash clear", + "alternatives": ["git stash drop "] }, { - "title": "Grab a single file from a stash", - "tip": "git checkout -- ", - "alternatives": ["git checkout stash@{0} -- "] + "title": "Grab a single file from a stash", + "tip": "git checkout -- ", + "alternatives": ["git checkout stash@{0} -- "] }, { - "title": "Show all tracked files", - "tip": "git ls-files -t" + "title": "Show all tracked files", + "tip": "git ls-files -t" }, { - "title": "Show all untracked files", - "tip": "git ls-files --others" + "title": "Show all untracked files", + "tip": "git ls-files --others" }, { - "title": "Show all ignored files", - "tip": "git ls-files --others -i --exclude-standard" + "title": "Show all ignored files", + "tip": "git ls-files --others -i --exclude-standard" }, { - "title": "Create new working tree from a repository (git 2.5)", - "tip": "git worktree add -b " + "title": "Create new working tree from a repository (git 2.5)", + "tip": "git worktree add -b " }, { - "title": "Create new working tree from HEAD state", - "tip": "git worktree add --detach HEAD" + "title": "Create new working tree from HEAD state", + "tip": "git worktree add --detach HEAD" }, { - "title": "Untrack files without deleting", - "tip": "git rm --cached ", - "alternatives": ["git rm --cached -r "] + "title": "Untrack files without deleting", + "tip": "git rm --cached ", + "alternatives": ["git rm --cached -r "] }, { - "title": "Before deleting untracked files/directory, do a dry run to get the list of these files/directories", - "tip": "git clean -n" + "title": "Before deleting untracked files/directory, do a dry run to get the list of these files/directories", + "tip": "git clean -n" }, { - "title": "Forcefully remove untracked files", - "tip": "git clean -f" + "title": "Forcefully remove untracked files", + "tip": "git clean -f" }, { - "title": "Forcefully remove untracked directory", - "tip": "git clean -f -d", - "alternatives": ["git clean -df"] + "title": "Forcefully remove untracked directory", + "tip": "git clean -f -d", + "alternatives": ["git clean -df"] }, { - "title": "Update all the submodules", - "tip": "git submodule foreach git pull" + "title": "Update all the submodules", + "tip": "git submodule foreach git pull" }, { - "title": "Show all commits in the current branch yet to be merged to master", - "tip": "git cherry -v master", - "alternatives": ["git cherry -v master "] + "title": "Show all commits in the current branch yet to be merged to master", + "tip": "git cherry -v master", + "alternatives": ["git cherry -v master "] }, { - "title": "Rename a branch", - "tip": "git branch -m ", - "alternatives": ["git branch -m [] "] + "title": "Rename a branch", + "tip": "git branch -m ", + "alternatives": ["git branch -m [] "] }, { - "title": "rebases 'feature' to 'master' and merges it in to master ", - "tip": "git checkout feature && git rebase @{-1} && git checkout @{-2} && git merge @{-1}" + "title": "rebases 'feature' to 'master' and merges it in to master ", + "tip": "git checkout feature && git rebase @{-1} && git checkout @{-2} && git merge @{-1}" }, { - "title": "Archive the `master` branch", - "tip": "git archive master --format=zip --output=master.zip" + "title": "Archive the `master` branch", + "tip": "git archive master --format=zip --output=master.zip" }, { - "title": "Modify previous commit without modifying the commit message", - "tip": "git add --all && git commit --amend --no-edit" + "title": "Modify previous commit without modifying the commit message", + "tip": "git add --all && git commit --amend --no-edit" }, { - "title": "Prunes branches that have been deleted in the remote.", - "tip": "git fetch -p", - "alternatives": ["git remote prune origin"] + "title": "Prunes branches that have been deleted in the remote.", + "tip": "git fetch -p", + "alternatives": ["git remote prune origin"] }, { - "title": "Retrieve the commit hash of the initial revision.", - "tip": " git rev-list --reverse HEAD | head -1" + "title": "Retrieve the commit hash of the initial revision.", + "tip": " git rev-list --reverse HEAD | head -1" }, { - "title": "Visualize the version tree.", - "tip": "git log --pretty=oneline --graph --decorate --all", - "alternatives": ["gitk --all"] + "title": "Visualize the version tree.", + "tip": "git log --pretty=oneline --graph --decorate --all", + "alternatives": ["gitk --all"] }, { - "title": "Deploying git tracked subfolder to gh-pages", - "tip": "git subtree push --prefix subfolder_name origin gh-pages", - "alternatives": "git subtree push --prefix subfolder_name origin branch_name" + "title": "Deploying git tracked subfolder to gh-pages", + "tip": "git subtree push --prefix subfolder_name origin gh-pages", + "alternatives": "git subtree push --prefix subfolder_name origin branch_name" }, { - "title": "Adding a project to repo using subtree", - "tip": "git subtree add --prefix=/ --squash git@github.com:/.git master" + "title": "Adding a project to repo using subtree", + "tip": "git subtree add --prefix=/ --squash git@github.com:/.git master" }, { - "title": "Get latest changes in your repo for a linked project using subtree", - "tip": "git subtree pull --prefix=/ --squash git@github.com:/.git master" + "title": "Get latest changes in your repo for a linked project using subtree", + "tip": "git subtree pull --prefix=/ --squash git@github.com:/.git master" }, { - "title": "Export a branch with history to the a file.", - "tip": "git bundle create " + "title": "Export a branch with history to the a file.", + "tip": "git bundle create " }, { - "title": "Import from a bundle", - "tip": "git clone repo.bundle -b " + "title": "Import from a bundle", + "tip": "git clone repo.bundle -b " }, { - "title": "Get the name of current branch.", - "tip": "git rev-parse --abbrev-ref HEAD" + "title": "Get the name of current branch.", + "tip": "git rev-parse --abbrev-ref HEAD" }, { - "title": "Ignore one file on commit (e.g. Changelog).", - "tip": "git update-index --assume-unchanged Changelog; git commit -a; git update-index --no-assume-unchanged Changelog" + "title": "Ignore one file on commit (e.g. Changelog).", + "tip": "git update-index --assume-unchanged Changelog; git commit -a; git update-index --no-assume-unchanged Changelog" }, { - "title": "Stash changes before rebasing", - "tip": "git rebase --autostash" + "title": "Stash changes before rebasing", + "tip": "git rebase --autostash" }, { - "title": "Fetch pull request by ID to a local branch", - "tip": "git fetch origin pull//head:", - "alternatives": ["git pull origin pull//head:"] + "title": "Fetch pull request by ID to a local branch", + "tip": "git fetch origin pull//head:", + "alternatives": ["git pull origin pull//head:"] }, { - "title": "Show the most recent tag on the current branch.", - "tip": "git describe --tags --abbrev=0" + "title": "Show the most recent tag on the current branch.", + "tip": "git describe --tags --abbrev=0" }, { - "title": "Show inline word diff.", - "tip": "git diff --word-diff" + "title": "Show inline word diff.", + "tip": "git diff --word-diff" }, { - "title": "Don’t consider changes for tracked file.", - "tip": "git update-index --assume-unchanged " + "title": "Don’t consider changes for tracked file.", + "tip": "git update-index --assume-unchanged " }, { - "title": "Undo assume-unchanged.", - "tip": "git update-index --no-assume-unchanged " + "title": "Undo assume-unchanged.", + "tip": "git update-index --no-assume-unchanged " }, { - "title": "Clean the files from `.gitignore`.", - "tip": "git clean -X -f" + "title": "Clean the files from `.gitignore`.", + "tip": "git clean -X -f" }, { - "title": "Restore deleted file.", - "tip": "git checkout ^ -- " + "title": "Restore deleted file.", + "tip": "git checkout ^ -- " }, { - "title": "Restore file to a specific commit-hash", - "tip": "git checkout -- " + "title": "Restore file to a specific commit-hash", + "tip": "git checkout -- " }, { - "title": "Always rebase instead of merge on pull.", - "tip": "git config --global branch.autosetuprebase always" + "title": "Always rebase instead of merge on pull.", + "tip": "git config --global branch.autosetuprebase always" }, { - "title": "List all the alias and configs.", - "tip": "git config --list" + "title": "List all the alias and configs.", + "tip": "git config --list" }, { - "title": "Make git case sensitive.", - "tip": "git config --global core.ignorecase false" + "title": "Make git case sensitive.", + "tip": "git config --global core.ignorecase false" }, { - "title": "Auto correct typos.", - "tip": "git config --global help.autocorrect 1" + "title": "Auto correct typos.", + "tip": "git config --global help.autocorrect 1" }, { - "title": "Check if the change was a part of a release.", - "tip": "git name-rev --name-only " + "title": "Check if the change was a part of a release.", + "tip": "git name-rev --name-only " }, { - "title": "Dry run. (any command that supports dry-run flag should do.)", - "tip": "git clean -fd --dry-run" + "title": "Dry run. (any command that supports dry-run flag should do.)", + "tip": "git clean -fd --dry-run" }, { - "title": "Marks your commit as a fix of a previous commit.", - "tip": "git commit --fixup " + "title": "Marks your commit as a fix of a previous commit.", + "tip": "git commit --fixup " }, { - "title": "squash fixup commits normal commits.", - "tip": "git rebase -i --autosquash" + "title": "squash fixup commits normal commits.", + "tip": "git rebase -i --autosquash" }, { - "title": "skip staging area during commit.", - "tip": "git commit -am 'commit message'" -},{ - "title": "List ignored files.", - "tip": "git check-ignore *" -},{ - "title": "Status of ignored files.", - "tip": "git status --ignored" -},{ - "title": "Commits in Branch1 that are not in Branch2", - "tip": "git log Branch1 ^Branch2" + "title": "skip staging area during commit.", + "tip": "git commit -am " }, { - "title": "reuse recorded resolution, record and reuse previous conflicts resolutions.", - "tip":"git config --global rerere.enabled 1" -},{ - "title": "Open all conflicted files in an editor.", - "tip": "git diff --name-only | uniq | xargs $EDITOR" + "title": "List ignored files.", + "tip": "git check-ignore *" +}, { + "title": "Status of ignored files.", + "tip": "git status --ignored" +}, { + "title": "Commits in Branch1 that are not in Branch2", + "tip": "git log Branch1 ^Branch2" +}, { + "title": "reuse recorded resolution, record and reuse previous conflicts resolutions.", + "tip":"git config --global rerere.enabled 1" +}, { + "title": "Open all conflicted files in an editor.", + "tip": "git diff --name-only | uniq | xargs $EDITOR" +}, { + "title": "Count unpacked number of objects and their disk consumption.", + "tip": "git count-objects --human-readable" }]