Thorough introduction to #Java10's new `var` keyword. Where to use it and where not, how it works, and what it does to readability: https://t.co/Mc4CbiDvb4 pic.twitter.com/GY79ziLEH3
— Nicolai Parlog (@nipafx) November 16, 2017
A completely ignorant, childish person with no manners.
$ git show commit deadbeef16165bb95a541321a7acf9cef9731c1d Author: Alexander Groß <agross@therightstuff.de> Date: Sat Feb 6 12:41:24 2010 +0100 This is an awesome commit! Why, you ask? Let me explain how I… diff --git a/hello.txt b/hello.txt index afdb358..4b5fa63 100644 --- a/hello.txt +++ b/hello.txt @@ -1,3 +1,4 @@ -I love deleting code -I replaced this line +with this line, because it’s better + +This should have been here since forever
Here are some better alternative names for the "master" branch in your source code repository:
- bleeding-edge
- nevergreen
- works-on-my-machine
- happy-merging-XD
- there-be-real-users
- features-come-here-to-die- (L°O°)L_|_|_
— Markus Tacker 🇳🇴 (@coderbyheart) March 6, 2018
HEAD
pointer$ git branch topic [<where>]
(
<where>
defaults to
HEAD
)
HEAD
is$ git checkout topic
HEAD
's position changes your working copy will
be updated.Uncommitted changes will be attempted to be preserved.
HEAD
HEAD
$ git checkout deadbeef Note: checking out 'deadbeef'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them…
You're on no branch when you checkout
a SHA, tag or
remote branch.
$ git reflog 6bbd21d HEAD@{0}: commit (amend): JUG WIP 392bf47 HEAD@{1}: commit (amend): JUG WIP e7d4298 HEAD@{2}: commit: JUG WIP 71ab831 HEAD@{3}: checkout: moving from gh-pages to jug 71ab831 HEAD@{4}: commit: Support more than one fade 76cd1b0 HEAD@{5}: commit: Tabs -> spaces b6f3d91 HEAD@{6}: commit: Tune letter spacing for long git commands cbc3b80 HEAD@{7}: commit: Fix creation of reproduction commit
$ git {add,reset HEAD,checkout} --patch
$ git update-index --[no-]assume-unchanged
$ git ls-files -v | grep '^h'
$ git commit --amend -m 'C was bad'
$ git reset --hard HEAD~
$ git filter-branch --subdirectory-filter src/lib -- --all
$ git filter-branch --index-filter 'git rm secret.txt' HEAD
svn:externals
(there be 🐉)
$ git svn-clone-externals svn://…
$ git checkout topic
$ git rebase master
Commit C
and D
is applied on top of master
as C'
and D'
.
This is from a project I am working on. #git
#rebase vs. #merge
pic.twitter.com/TRgsq7BSin
—
MiCHΛΞl (@michaelhenke)
April 6, 2015
How to get rid of C
when rebasing client
on master
?
$ git rebase --onto master server client
$ git rebase --onto B server client
git rebase -i ;) pic.twitter.com/Qy2k7Q0EQJ
—
nixCraft (@nixcraft)
May 7, 2017
$ git rebase --interactive A
Visualizing a "Git Merge" pic.twitter.com/RQJ2AV7JRQ
— David Rousset (@davrous) August 20, 2016
$ git checkout master
$ git merge topic
Recursive merge: Integrates two diverged branches.
$ git reset --hard E # Like a pro (covers recursive and ff merges): $ git reset --hard @@{1}
$ git checkout master
$ git merge topic
Fast-forward merge: The master
pointer can be moved from C
to E
without losing commits reachable from master
.
$ git merge --squash [--commit] topic
Apply commits from the topic
branch combined as a single commit on top of HEAD
.
$ git merge perf css report
Integrate any number of non-conflicting branches with a single merge commit.
$ git cherry-pick [--no-commit] D
Apply a commit from somewhere else.
obsolete
's commits reachable, but keep tree as-is
obsolete
)
$ git merge --strategy=ours obsolete
release
's tree
$ git commit-tree release^{tree} -m "Merge branch 'release'" -p HEAD -p release
pu
branchespu
git config --global rerere.enabled true git config --global rerere.autoUpdate true
# All branches were tested in isolation
$ git checkout -b pu master
$ for b in perf css report; do git merge $b; done
$ git reset --hard master
$ for b in css report; do git merge $b; done
$ git checkout master; git merge pu; git branch -d pu
Our 'Always amend commit and force push' model increased communication quality in our team a lot.
#GoldenCommit
@R0MMSEN
—
Marco Heimeshoff (@Heimeshoff)
July 13, 2017
Server (9418/tcp)
$ git daemon --base-path=. --export-all --verbose [4242] Ready to rumble
Client
$ git clone git://host/relative/path/to/repo/.git foo Cloning into 'foo'...
$ git remote add hans git://host/relative/path/to/repo/.git $ git fetch hans remote: Counting objects: 42, done. … From git://host/relative/path/to/repo/.git e3205a5..0282413 master -> hans/master
v1.0
works but v1.1
contains a regression$ git stash push -m "whatever you're doing"
$ git bisect start v1.1 v1.0
D
$ make test # => error
D
$ git bisect bad
B
$ make test # => success
B
$ git bisect good
C
$ make test # => success
C
$ git bisect good
# D is the first bad revision
$ git bisect reset
bisect
with cherry-pick
$ git checkout -b repro v1.1 && git commit -m 'repro'
$ git bisect start v1.1 v1.0
repro
commit$ git cherry-pick repro
D
+ R'
$ make test # => error
R'
$ git reset --hard HEAD~
D
$ git bisect bad
$ git cherry-pick repro
HEAD
state while searchinggit bisect run <some-script>
some-script
can do things like cherry-pick
ing reproductions, demo availablegit revert [--no-commit] <bad-commit>