1
0
mirror of https://github.com/namibia/tips.git synced 2024-06-16 17:02:20 +00:00

clean files from .gitignore

This commit is contained in:
Hemanth.HM 2015-12-21 19:25:46 +05:30
parent 6197057dc7
commit 8181a37dd1
2 changed files with 296 additions and 286 deletions

View File

@ -71,6 +71,7 @@
* [Show inline word diff.](https://github.com/git-tips/tips#show-inline-word-diff) * [Show inline word diff.](https://github.com/git-tips/tips#show-inline-word-diff)
* [Dont consider changes for tracked file.](https://github.com/git-tips/tips#dont-consider-changes-for-tracked-file) * [Dont consider changes for tracked file.](https://github.com/git-tips/tips#dont-consider-changes-for-tracked-file)
* [Undo assume-unchanged.](https://github.com/git-tips/tips#undo-assume-unchanged) * [Undo assume-unchanged.](https://github.com/git-tips/tips#undo-assume-unchanged)
* [Clean the files from `.gitignore`.](https://github.com/git-tips/tips#clean-the-files-from-gitignore)
<!-- Dont remove or change the comment below that can break automatic updates. More info at <http://npm.im/doxie.inject>. --> <!-- Dont remove or change the comment below that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
<!-- @doxie.inject end toc --> <!-- @doxie.inject end toc -->
@ -497,5 +498,10 @@ git update-index --assume-unchanged <file_name>
git update-index --no-assume-unchanged <file_name> git update-index --no-assume-unchanged <file_name>
``` ```
## Clean the files from `.gitignore`.
```sh
git clean -X -f
```
<!-- Dont remove or change the comment below that can break automatic updates. More info at <http://npm.im/doxie.inject>. --> <!-- Dont remove or change the comment below that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
<!-- @doxie.inject end --> <!-- @doxie.inject end -->

576
tips.json
View File

@ -1,288 +1,292 @@
[ [
{ {
"title": "Everyday Git in twenty commands or so", "title": "Everyday Git in twenty commands or so",
"tip": "git help everyday" "tip": "git help everyday"
}, },
{ {
"title": "Show helpful guides that come with Git", "title": "Show helpful guides that come with Git",
"tip": "git help -g" "tip": "git help -g"
}, },
{ {
"title": "Overwrite pull", "title": "Overwrite pull",
"tip": "git fetch --all && git reset --hard origin/master" "tip": "git fetch --all && git reset --hard origin/master"
}, },
{ {
"title": "List of all files till a commit", "title": "List of all files till a commit",
"tip": "git ls-tree --name-only -r <commit-ish>" "tip": "git ls-tree --name-only -r <commit-ish>"
}, },
{ {
"title": "Git reset first commit", "title": "Git reset first commit",
"tip": "git update-ref -d HEAD" "tip": "git update-ref -d HEAD"
}, },
{ {
"title": "List all the conflicted files", "title": "List all the conflicted files",
"tip": "git diff --name-only --diff-filter=U" "tip": "git diff --name-only --diff-filter=U"
}, },
{ {
"title": "List of all files changed in a commit", "title": "List of all files changed in a commit",
"tip": "git diff-tree --no-commit-id --name-only -r <commit-ish>" "tip": "git diff-tree --no-commit-id --name-only -r <commit-ish>"
}, },
{ {
"title":"Unstaged changes since last commit", "title":"Unstaged changes since last commit",
"tip":"git diff" "tip":"git diff"
}, },
{ {
"title":"Changes staged for commit", "title":"Changes staged for commit",
"tip":"git diff --cached" "tip":"git diff --cached"
}, },
{ {
"title":"Show both staged and unstaged changes", "title":"Show both staged and unstaged changes",
"tip":"git diff HEAD" "tip":"git diff HEAD"
}, },
{ {
"title": "List all branches that are already merged into master", "title": "List all branches that are already merged into master",
"tip": "git checkout master && git branch --merged" "tip": "git checkout master && git branch --merged"
}, },
{ {
"title": "Quickly switch to the previous branch", "title": "Quickly switch to the previous branch",
"tip": "git checkout -" "tip": "git checkout -"
}, },
{ {
"title": "Remove branches that have already been merged with master", "title": "Remove branches that have already been merged with master",
"tip": "git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" "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", "title": "List all branches and their upstreams, as well as last commit on branch",
"tip": "git branch -vv" "tip": "git branch -vv"
}, },
{ {
"title": "Track upstream branch", "title": "Track upstream branch",
"tip": "git branch -u origin/mybranch" "tip": "git branch -u origin/mybranch"
}, },
{ {
"title": "Delete local branch", "title": "Delete local branch",
"tip": "git branch -d <local_branchname>" "tip": "git branch -d <local_branchname>"
}, },
{ {
"title": "Delete remote branch", "title": "Delete remote branch",
"tip": "git push origin --delete <remote_branchname>", "tip": "git push origin --delete <remote_branchname>",
"alternatives": ["git push origin :<remote_branchname>"] "alternatives": ["git push origin :<remote_branchname>"]
}, },
{ {
"title": "Undo local changes with the last content in head", "title": "Undo local changes with the last content in head",
"tip": "git checkout -- <file_name>" "tip": "git checkout -- <file_name>"
}, },
{ {
"title":"Revert: Undo a commit by creating a new commit", "title":"Revert: Undo a commit by creating a new commit",
"tip":"git revert <commit-ish>" "tip":"git revert <commit-ish>"
}, },
{ {
"title":"Reset: Discard commits, advised for private branch", "title":"Reset: Discard commits, advised for private branch",
"tip":"git reset <commit-ish>" "tip":"git reset <commit-ish>"
}, },
{ {
"title": "Reword the previous commit message", "title": "Reword the previous commit message",
"tip": "git commit -v --amend" "tip": "git commit -v --amend"
}, },
{ {
"title": "Changing a remote's URL", "title": "Changing a remote's URL",
"tip": "git remote set-url origin <URL>" "tip": "git remote set-url origin <URL>"
}, },
{ {
"title": "Get list of all remote references", "title": "Get list of all remote references",
"tip": "git remote", "tip": "git remote",
"alternatives": ["git remote show"] "alternatives": ["git remote show"]
}, },
{ {
"title": "Get list of all local and remote branches", "title": "Get list of all local and remote branches",
"tip": "git branch -a" "tip": "git branch -a"
}, },
{ {
"title": "Get only remote branches", "title": "Get only remote branches",
"tip": "git branch -r" "tip": "git branch -r"
}, },
{ {
"title": "Stage parts of a changed file, instead of the entire file", "title": "Stage parts of a changed file, instead of the entire file",
"tip": "git add -p" "tip": "git add -p"
}, },
{ {
"title": "Get git bash completion", "title": "Get git bash completion",
"tip": "curl http://git.io/vfhol > ~/.git-completion.bash && echo '[ -f ~/.git-completion.bash ] && . ~/.git-completion.bash' >> ~/.bashrc" "tip": "curl http://git.io/vfhol > ~/.git-completion.bash && echo '[ -f ~/.git-completion.bash ] && . ~/.git-completion.bash' >> ~/.bashrc"
}, },
{ {
"title": "What changed since two weeks?", "title": "What changed since two weeks?",
"tip": "git whatchanged --since='2 weeks ago'" "tip": "git whatchanged --since='2 weeks ago'"
}, },
{ {
"title": "See all commits made since forking from master", "title": "See all commits made since forking from master",
"tip": "git log --no-merges --stat --reverse master.." "tip": "git log --no-merges --stat --reverse master.."
}, },
{ {
"title": "Pick commits across branches using cherry-pick", "title": "Pick commits across branches using cherry-pick",
"tip": "git checkout <branch-name> && cherry-pick <commit-ish>" "tip": "git checkout <branch-name> && cherry-pick <commit-ish>"
}, },
{ {
"title": "Find out branches containing commit-hash", "title": "Find out branches containing commit-hash",
"tip": "git branch -a --contains <commit-ish>", "tip": "git branch -a --contains <commit-ish>",
"alternatives": ["git branch --contains <commit-ish>"] "alternatives": ["git branch --contains <commit-ish>"]
}, },
{ {
"title": "Git Aliases", "title": "Git Aliases",
"tip": "git config --global alias.<handle> <command> \ngit config --global alias.st status" "tip": "git config --global alias.<handle> <command> \ngit config --global alias.st status"
}, },
{ {
"title":"Saving current state of tracked files without commiting", "title":"Saving current state of tracked files without commiting",
"tip": "git stash", "tip": "git stash",
"alternatives": ["git stash save"] "alternatives": ["git stash save"]
}, },
{ {
"title":"Saving current state including untracked files", "title":"Saving current state including untracked files",
"tip": "git stash save -u", "tip": "git stash save -u",
"alternatives": ["git stash save --include-untracked"] "alternatives": ["git stash save --include-untracked"]
}, },
{ {
"title":"Show list of all saved stashes", "title":"Show list of all saved stashes",
"tip": "git stash list" "tip": "git stash list"
}, },
{ {
"title": "Apply any stash without deleting from the stashed list", "title": "Apply any stash without deleting from the stashed list",
"tip": "git stash apply <stash@{n}>" "tip": "git stash apply <stash@{n}>"
}, },
{ {
"title":"Apply last stashed state and delete it from stashed list", "title":"Apply last stashed state and delete it from stashed list",
"tip": "git stash pop", "tip": "git stash pop",
"alternatives": ["git stash apply stash@{0} && git stash drop stash@{0}"] "alternatives": ["git stash apply stash@{0} && git stash drop stash@{0}"]
}, },
{ {
"title": "Delete all stored stashes", "title": "Delete all stored stashes",
"tip": "git stash clear", "tip": "git stash clear",
"alternatives": ["git stash drop <stash@{n}>"] "alternatives": ["git stash drop <stash@{n}>"]
}, },
{ {
"title":"Show all tracked files", "title":"Show all tracked files",
"tip":"git ls-files -t" "tip":"git ls-files -t"
}, },
{ {
"title":"Show all untracked files", "title":"Show all untracked files",
"tip":"git ls-files --others" "tip":"git ls-files --others"
}, },
{ {
"title": "Show all ignored files", "title": "Show all ignored files",
"tip": "git ls-files --others -i --exclude-standard" "tip": "git ls-files --others -i --exclude-standard"
}, },
{ {
"title": "Create new working tree from a repository (git 2.5)", "title": "Create new working tree from a repository (git 2.5)",
"tip":"git worktree add -b <branch-name> <path> <start-point>" "tip":"git worktree add -b <branch-name> <path> <start-point>"
}, },
{ {
"title": "Create new working tree from HEAD state", "title": "Create new working tree from HEAD state",
"tip": "git worktree add --detach <path> HEAD" "tip": "git worktree add --detach <path> HEAD"
}, },
{ {
"title": "Before deleting untracked files/directory, do a dry run to get the list of these files/directories", "title": "Before deleting untracked files/directory, do a dry run to get the list of these files/directories",
"tip": "git clean -n" "tip": "git clean -n"
}, },
{ {
"title": "Forcefully remove untracked files", "title": "Forcefully remove untracked files",
"tip": "git clean -f" "tip": "git clean -f"
}, },
{ {
"title": "Forcefully remove untracked directory", "title": "Forcefully remove untracked directory",
"tip": "git clean -f -d", "tip": "git clean -f -d",
"alternatives": ["git clean -df"] "alternatives": ["git clean -df"]
}, },
{ {
"title": "Update all the submodules", "title": "Update all the submodules",
"tip": "git submodule foreach git pull" "tip": "git submodule foreach git pull"
}, },
{ {
"title": "Show all commits in the current branch yet to be merged to master", "title": "Show all commits in the current branch yet to be merged to master",
"tip": "git cherry -v master", "tip": "git cherry -v master",
"alternatives": ["git cherry -v master <branch-to-be-merged>"] "alternatives": ["git cherry -v master <branch-to-be-merged>"]
}, },
{ {
"title": "Rename a branch", "title": "Rename a branch",
"tip": "git branch -m <new-branch-name>", "tip": "git branch -m <new-branch-name>",
"alternatives": ["git branch -m [<old-branch-name>] <new-branch-name>"] "alternatives": ["git branch -m [<old-branch-name>] <new-branch-name>"]
}, },
{ {
"title": "rebases 'feature' to 'master' and merges it in to master ", "title": "rebases 'feature' to 'master' and merges it in to master ",
"tip": "git checkout feature && git rebase @{-1} && git checkout @{-2} && git merge @{-1}" "tip": "git checkout feature && git rebase @{-1} && git checkout @{-2} && git merge @{-1}"
}, },
{ {
"title": "Archive the `master` branch", "title": "Archive the `master` branch",
"tip": "git archive master --format=zip --output=master.zip" "tip": "git archive master --format=zip --output=master.zip"
}, },
{ {
"title": "Modify previous commit without modifying the commit message", "title": "Modify previous commit without modifying the commit message",
"tip": "git add --all && git commit --amend --no-edit" "tip": "git add --all && git commit --amend --no-edit"
}, },
{ {
"title": "Prunes branches that have been deleted in the remote.", "title": "Prunes branches that have been deleted in the remote.",
"tip": "git fetch -p", "tip": "git fetch -p",
"alternatives":["git remote prune origin"] "alternatives":["git remote prune origin"]
}, },
{ {
"title": "Retrieve the commit hash of the initial revision.", "title": "Retrieve the commit hash of the initial revision.",
"tip": " git rev-list --reverse HEAD | head -1" "tip": " git rev-list --reverse HEAD | head -1"
}, },
{ {
"title": "Visualize the version tree.", "title": "Visualize the version tree.",
"tip": "git log --pretty=oneline --graph --decorate --all", "tip": "git log --pretty=oneline --graph --decorate --all",
"alternatives":["gitk --all"] "alternatives":["gitk --all"]
}, },
{ {
"title": "Deploying git tracked subfolder to gh-pages", "title": "Deploying git tracked subfolder to gh-pages",
"tip": "git subtree push --prefix subfolder_name origin gh-pages", "tip": "git subtree push --prefix subfolder_name origin gh-pages",
"alternatives": "git subtree push --prefix subfolder_name origin branch_name" "alternatives": "git subtree push --prefix subfolder_name origin branch_name"
}, },
{ {
"title": "Adding a project to repo using subtree", "title": "Adding a project to repo using subtree",
"tip": "git subtree add --prefix=<directory_name>/<project_name> --squash git@github.com:<username>/<project_name>.git master" "tip": "git subtree add --prefix=<directory_name>/<project_name> --squash git@github.com:<username>/<project_name>.git master"
}, },
{ {
"title": "Get latest changes in your repo for a linked project using subtree", "title": "Get latest changes in your repo for a linked project using subtree",
"tip": "git subtree pull --prefix=<directory_name>/<project_name> --squash git@github.com:<username>/<project_name>.git master" "tip": "git subtree pull --prefix=<directory_name>/<project_name> --squash git@github.com:<username>/<project_name>.git master"
}, },
{ {
"title": "Export a branch with history to the a file.", "title": "Export a branch with history to the a file.",
"tip": "git bundle create <file> <branch-name>" "tip": "git bundle create <file> <branch-name>"
}, },
{ {
"title": "Import from a bundle", "title": "Import from a bundle",
"tip": "git clone repo.bundle <repo-dir> -b <branch-name>" "tip": "git clone repo.bundle <repo-dir> -b <branch-name>"
}, },
{ {
"title": "Get the name of current branch.", "title": "Get the name of current branch.",
"tip": "git rev-parse --abbrev-ref HEAD" "tip": "git rev-parse --abbrev-ref HEAD"
}, },
{ {
"title": "Ignore one file on commit (e.g. 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" "tip": "git update-index --assume-unchanged Changelog; git commit -a; git update-index --no-assume-unchanged Changelog"
}, },
{ {
"title": "Stash changes before rebasing", "title": "Stash changes before rebasing",
"tip": "git rebase --autostash" "tip": "git rebase --autostash"
}, },
{ {
"title": "Fetch pull request by ID to a local branch", "title": "Fetch pull request by ID to a local branch",
"tip": "git fetch origin pull/<id>/head:<branch-name>", "tip": "git fetch origin pull/<id>/head:<branch-name>",
"alternatives": ["git pull origin pull/<id>/head:<branch-name>"] "alternatives": ["git pull origin pull/<id>/head:<branch-name>"]
}, },
{ {
"title": "Show the most recent tag on the current branch.", "title": "Show the most recent tag on the current branch.",
"tip": "git describe --tags --abbrev=0" "tip": "git describe --tags --abbrev=0"
}, },
{ {
"title": "Show inline word diff.", "title": "Show inline word diff.",
"tip": "git diff --word-diff" "tip": "git diff --word-diff"
}, },
{ {
"title": "Dont consider changes for tracked file.", "title": "Dont consider changes for tracked file.",
"tip": "git update-index --assume-unchanged <file_name>" "tip": "git update-index --assume-unchanged <file_name>"
}, },
{ {
"title": "Undo assume-unchanged.", "title": "Undo assume-unchanged.",
"tip": "git update-index --no-assume-unchanged <file_name>" "tip": "git update-index --no-assume-unchanged <file_name>"
} },
{
"title": "Clean the files from `.gitignore`.",
"tip": "git clean -X -f"
}
] ]