Skip to content

Instantly share code, notes, and snippets.

@taichiman
Last active December 30, 2015 00:09
Show Gist options
  • Save taichiman/7747280 to your computer and use it in GitHub Desktop.
Save taichiman/7747280 to your computer and use it in GitHub Desktop.
Git, git, git
Commit:
git diff --check (убирает whitespace)
==
git update-index --assume-unchanged <file>
git update-index --no-assume-unchanged <file>
==
git log one-branch..another-branch shows everything that one-branch needs to have everything another-branch has.
You may also be interested in git show-branch as a way to see what's where.
==
@taichiman
Copy link
Author

Aliases:

Adding to the existing answers (esp. Jan's), an alias could be created to show the diff and/or log prior to a merge. For completeness, the other answers omit the fetch to be done first before "previewing" the merge; an alias can combine these two steps into one.

So, building on "git log ..otherbranch", you can add the following to ~/.gitconfig (emulating something similar to hg incoming/outgoing):

...
[alias]
# fetch and show what would be merged (use option "-p" to see patch)
incoming = "!git remote update -p; git log ..@{u}"

For symmetry, the following alias can be used to show what is committed and would be pushed, prior to pushing:

# what would be pushed (currently committed); see also alias difr
outgoing = log @{u}..

And then you can run "git incoming" to show a lot of changes, or "git incoming -p" to show the patch (i.e., the "diff"), "git incoming --pretty=oneline", for a terse summary, etc. You can then (optionally) run "git pull" to actually merge. (Though, since you've already fetched, the merge could be done directly.)

Likewise, "git outgoing" shows what would be pushed if you were to run "git push".

@taichiman
Copy link
Author

посмотреть как менялся файл
git log --graph --decorate --oneline Gemfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment