Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tips.json: submodule to latest commit #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
hemanth merged 1 commit into git-tips:master from angelskieglazki:feature/update-submodule-to-latest-commit
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
<!-- @doxie.inject end toc -->
Expand All @@ -191,6 +195,11 @@ git help -g
git log -S'<a term in the source>'
```

## Show changes over time for specific file
```sh
git log -p <file_name>
```

## Remove sensitive data from history, after a push
```sh
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch <path-to-your-file>' --prune-empty --tag-name-filter cat -- --all && git push origin --force --all
Expand All @@ -211,6 +220,11 @@ git ls-tree --name-only -r <commit-ish>
git update-ref -d HEAD
```

## Reset: preserve uncommitted local changes
```sh
git reset --keep <commit>
```

## List all the conflicted files
```sh
git diff --name-only --diff-filter=U
Expand Down Expand Up @@ -295,6 +309,11 @@ __Alternatives:__
git push origin :<remote_branchname>
```


```sh
git branch -dr <remote/branch>
```

## Delete local tag
```sh
git tag -d <tag-name>
Expand Down Expand Up @@ -1015,6 +1034,11 @@ git push -f <remote-name> <branch-name>
git remote add <remote-nickname> <remote-url>
```

## 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 <file-name>
Expand Down Expand Up @@ -1191,5 +1215,14 @@ git rebase --onto <new_base> <old_base>
git config --global url.'git@github.com:'.insteadOf 'https://github.com/'
```

## Update a submodule to the latest commit
```sh
cd <path-to-submodule>
git pull origin <branch>
cd <root-of-your-main-project>
git add <path-to-submodule>
git commit -m "submodule updated"
```

<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
<!-- @doxie.inject end -->
5 changes: 4 additions & 1 deletion tips.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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 <path-to-submodule>\ngit pull origin <branch>\ncd <root-of-your-main-project>\ngit add <path-to-submodule>\ngit commit -m \"submodule updated\""
}
]

AltStyle によって変換されたページ (->オリジナル) /