1
0
mirror of https://github.com/namibia/tips.git synced 2024-11-14 17:24:08 +00:00
git-tips/tips.json

139 lines
3.8 KiB
JSON
Raw Normal View History

2015-07-15 11:01:27 +00:00
[
{
"title": "Overwrite pull",
"tip": "git fetch --all && git reset --hard origin/master"
},
{
"title": "List of all files till a commit",
2015-07-15 11:01:27 +00:00
"tip": "git ls-tree --name-only -r <commit-ish>"
},
{
"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"
},
2015-07-28 16:38:59 +00:00
{
"title": "List of all files changed in a commit",
"tip": "git diff-tree --no-commit-id --name-only -r <commit-ish>"
},
{
"title":"Unstaged changes since last commit",
"tip":"git diff"
},
{
"title":"Changes staged for commit",
"tip":"git diff --cached"
},
{
"title":"Show both staged and unstaged changes",
"tip":"git diff HEAD"
},
2015-07-15 11:01:27 +00:00
{
"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": "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": "Track upstream branch",
"tip": "git branch -u origin/mybranch"
},
{
"title": "Delete local branch",
2015-07-16 03:37:15 +00:00
"tip": "git branch -d <local_branchname>"
},
{
"title": "Delete remote branch",
2015-07-16 03:37:15 +00:00
"tip": "git push origin :<remote_branchname>"
2015-07-15 17:26:22 +00:00
},
{
"title": "Undo local changes with the last content in head",
2015-07-16 03:37:15 +00:00
"tip": "git checkout -- <file_name>"
},
{
"title": "Changing a remote's URL",
"tip": "git remote set-url origin <URL>"
2015-07-16 06:55:13 +00:00
},
{
"title": "Get list of all remote references",
2015-07-17 06:57:32 +00:00
"tip": "git remote",
2015-07-17 07:31:25 +00:00
"alternatives": ["git remote show"]
},
{
"title": "Get list of all local and remote branches",
"tip": "git branch -a"
},
{
"title": "Get only remote branches",
"tip": "git branch -r"
},
2015-07-16 06:55:13 +00:00
{
"title": "Stage parts of a changed file, instead of the entire file",
"tip": "git add -p"
2015-07-17 01:21:14 +00:00
},
{
"title": "Get git bash completion",
"tip": "curl http://git.io/vfhol > ~/.git-completion.bash && echo '[ -f ~/.git-completion.bash ] && . ~/.git-completion.bash' >> ~/.bashrc"
2015-07-22 07:56:24 +00:00
},
{
"title": "What changed since two weeks?",
"tip": "git whatchanged --since='2 weeks ago'"
2015-07-25 09:52:52 +00:00
},
{
"title": "Pick commits across branches using cherry-pick",
"tip": "git checkout <branch-name> && cherry-pick <commit-ish>"
},
{
"title": "Find out branches containing commit-hash",
"tip": "git branch -a --contains <commit-ish>",
"alternatives": ["git branch --contains <commit-ish>"]
2015-07-27 04:03:30 +00:00
},
{
"title": "Git Aliases",
"tip": "git config --global alias.<handle> <command> \ngit config --global alias.st status"
},
{
"title":"Saving current state of tracked files without commiting",
"tip": "git stash"
},
{
"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 <stash@{n}>"
},
{
"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 <stash@{n}>"]
},
{
"title":"Show all tracked files",
"tip":"git ls-files -t"
},
{
"title":"Show all untracked files",
"tip":"git ls-files --others"
}
2015-07-15 11:01:27 +00:00
]