Using GIT

Disclaimer

Glossary

History graph

Tag

Branch

HEAD

After commit

HEAD

Detached HEAD

HEAD

Detached HEAD after commit

HEAD

Common operations

Examine the history

Referencing a commit

HEAD^^3~2^2

HEAD

Ranges

red..blue

red..green

red...green

git gui

gitk

merge

HEAD

git merge blue

HEAD

fast-forward

HEAD

git merge blue

HEAD

rebase

HEAD

git rebase blue

HEAD

fetch

  $ git branch -a
* 10.1
  bb-10.1-monty
  bb-10.1-rediscover
  bb-10.1-serg
  galera-review
  remotes/origin/10.1
  remotes/origin/10.1-explain-json
  remotes/origin/bb-10.1-4ksectors
  remotes/origin/bb-10.1-serg
  remotes/origin/bb-fast-connect
  remotes/origin/bb-set-statement
  remotes/gsoc/selfTuningOptimizer
  remotes/roles/10.1

pull

pull/push --overwrite

mergetool

Move changes to a new branch

new_work HEAD HEAD remote/

clean history

git rebase --interactive HEAD~5

pick a1e3eaf fix a duplicate macro definition
pick de4cfab sort a non-deterministic test result
pick b4daf8e split an assert
pick 90f2ec5 bugfix: incorrect cast causing random memory write
pick ab440b0 update sysvars_server_embedded,32bit.rdiff

# Rebase fe0112e..ab440b0 onto fe0112e
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell

Keep a backup

Keep a backup

backup HEAD HEAD

bisect

$ git bisect start
$ git bisect bad
$ git bisect good HEAD~12
Bisecting: 5 revisions left to test (roughly 3 steps)
[fe0112e2] MDEV-7424: InnoDB: Assertion failure in thread 139901753345792   in file buf0mtflu.cc line 439
$ make; cd mysql-test; ./mtr sometest
$ git bisect good
Bisecting: 2 revisions left to test (roughly 2 steps)
[de4cfabe] sort a non-deterministic test result
$ 

automating bisect

$ git bisect start
$ git bisect bad
$ git bisect good HEAD~12
Bisecting: 5 revisions left to test (roughly 3 steps)
[fe0112e2] MDEV-7424: InnoDB: Assertion failure in thread 139901753345792   in file buf0mtflu.cc line 439
$ git bisect run make-and-run-mtr --noreorder foo bar

$ cat make-and-run-mtr
#!/bin/sh -ex
make -j5 || exit 125
cd mysql-test && ./mtr "$@"

Multiple repositories
bzr style