diff --git a/README.md b/README.md index fb6717c..4f18925 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,12 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`. * [Everyday Git in twenty commands or so](#everyday-git-in-twenty-commands-or-so) * [Show helpful guides that come with Git](#show-helpful-guides-that-come-with-git) * [Search change by content](#search-change-by-content) +* [Show changes over time for specific file](#show-changes-over-time-for-specific-file) * [Remove sensitive data from history, after a push](#remove-sensitive-data-from-history-after-a-push) * [Sync with remote, overwrite local changes](#sync-with-remote-overwrite-local-changes) * [List of all files till a commit](#list-of-all-files-till-a-commit) * [Git reset first commit](#git-reset-first-commit) +* [Reset: preserve uncommitted local changes](#reset-preserve-uncommitted-local-changes) * [List all the conflicted files](#list-all-the-conflicted-files) * [List of all files changed in a commit](#list-of-all-files-changed-in-a-commit) * [Unstaged changes since last commit](#unstaged-changes-since-last-commit) @@ -139,6 +141,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`. * [Unstaging Staged file](#unstaging-staged-file) * [Force push to Remote Repository](#force-push-to-remote-repository) * [Adding Remote name](#adding-remote-name) +* [List all currently configured remotes](#list-all-currently-configured-remotes) * [Show the author, time and last revision made to each line of a given file](#show-the-author-time-and-last-revision-made-to-each-line-of-a-given-file) * [Group commits by authors and title](#group-commits-by-authors-and-title) * [Forced push but still ensure you don't overwrite other's work](#forced-push-but-still-ensure-you-dont-overwrite-others-work) @@ -169,6 +172,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`. * [Push a new local branch to remote repository and track](#push-a-new-local-branch-to-remote-repository-and-track) * [Change a branch base](#change-a-branch-base) * [Use SSH instead of HTTPs for remotes](#use-ssh-instead-of-https-for-remotes) +* [Update a submodule to the latest commit](#update-a-submodule-to-the-latest-commit) @@ -191,6 +195,11 @@ git help -g git log -S'' ``` +## Show changes over time for specific file +```sh +git log -p +``` + ## Remove sensitive data from history, after a push ```sh git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch ' --prune-empty --tag-name-filter cat -- --all && git push origin --force --all @@ -211,6 +220,11 @@ git ls-tree --name-only -r git update-ref -d HEAD ``` +## Reset: preserve uncommitted local changes +```sh +git reset --keep +``` + ## List all the conflicted files ```sh git diff --name-only --diff-filter=U @@ -295,6 +309,11 @@ __Alternatives:__ git push origin : ``` + +```sh +git branch -dr +``` + ## Delete local tag ```sh git tag -d @@ -1015,6 +1034,11 @@ git push -f git remote add ``` +## List all currently configured remotes +```sh +git remote -v +``` + ## Show the author, time and last revision made to each line of a given file ```sh git blame @@ -1191,5 +1215,14 @@ git rebase --onto git config --global url.'git@github.com:'.insteadOf 'https://github.com/' ``` +## Update a submodule to the latest commit +```sh +cd +git pull origin +cd +git add +git commit -m "submodule updated" +``` + diff --git a/tips.json b/tips.json index 8e7f434..6a1a001 100644 --- a/tips.json +++ b/tips.json @@ -512,5 +512,8 @@ }, { "title": "Use SSH instead of HTTPs for remotes", "tip": "git config --global url.'git@github.com:'.insteadOf 'https://github.com/'" - } + }, { + "title": "Update a submodule to the latest commit", + "tip": "cd \ngit pull origin \ncd \ngit add \ngit commit -m \"submodule updated\"" + } ]