1
0
mirror of https://github.com/namibia/tips.git synced 2024-11-13 08:46:29 +00:00
git-tips/tips.json
2015-07-22 13:26:24 +05:30

80 lines
2.1 KiB
JSON

[
{
"title": "Overwrite pull",
"tip": "git fetch --all && git reset --hard origin/master"
},
{
"title": "List of all the files changed in a commit",
"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"
},
{
"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",
"tip": "git branch -d <local_branchname>"
},
{
"title": "Delete remote branch",
"tip": "git push origin :<remote_branchname>"
},
{
"title": "Undo local changes with the last content in head",
"tip": "git checkout -- <file_name>"
},
{
"title": "Changing a remote's URL",
"tip": "git remote set-url origin <URL>"
},
{
"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 only remote branches",
"tip": "git branch -r"
},
{
"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": "What changed since two weeks?",
"tip": "git whatchanged --since='2 weeks ago'"
}
]