git.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:41:52 +0200
changeset 1903 901e7394849f
parent 1815 49fb4309d4d0
child 1905 fba288d59662
permissions -rw-r--r--
Decrease intent to increase space usage on mobile.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1089
diff changeset
     2
.. include:: HEADER.rst
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
======
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 Git.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
======
1032
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1002
diff changeset
     7
.. contents::
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Setup git.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
==========
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
Debian.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
-------
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
For Etch Degian release use git-core package from backports,
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
old 1.4 version of git very dumb compared to new version 1.5::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
  $ sudo apt-get install git-core
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
After install setup some options::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
  $ git config --global user.name "Oleksandr Gavenko"
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
  $ git config --global user.mail "gavenkoa@gmail.com"
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
  $ cat ~/.gitconfig
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
  [user]
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
    name = Oleksandr Gavenko
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
    mail = gavenkoa@gmail.com
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
Cygwin.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
-------
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
  $ setup.exe -p git
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
git over proxy.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
===============
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
Only http:// protocol support proxy (not git://)::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
  $ export http_proxy="http://username:password@proxy:port/"
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
  $ git clone http://github.com/$user/$proj.git $proj
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
You can store proxy settings under repository local config file::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
  $ git config http.proxy http://$user:$passwd@$ip:$port
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
Start your project.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
===================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
Setup proj space on fs::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
  $ mkdir proj
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
  $ cd proj
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
  $ git init
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
  Initialized empty Git repository in /home/user/tmp/proj/.git/
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
  $ ls -a
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
  . .. .git
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
Add file, make changes, commit all::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
  $ emacs Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
  ... C-x C-c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
  $ emacs app.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
  ... C-x C-c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
  $ git add Makefile app.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
  $ git status
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
  # On branch master
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
  #
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
  # Initial commit
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
  #
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
  # Changes to be committed:
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
  #   (use "git rm --cached <file>..." to unstage)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
  #
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
  #       new file: Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
  #       new file: app.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
  #
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
or just::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
  $ git add .
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
Commit newlly added file::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
  $ git commit
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
  ... Write message log ...
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
  Created initial commit 2169263: My first commit massage.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
   1 files changed, 4 insertions(+), 0 deletions(-)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
   create mode 100644 app.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
Undo tracking added file.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
=========================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
You do::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
  $ git add badfile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
  $ git status
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
  # On branch master
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
  # Changes to be committed:
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
  #   (use "git reset HEAD <file>..." to unstage)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
  #
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
  #       new file:   badfile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
  #
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
To stop tracking badfile do::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
  $ git rm --cached badfile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
  $ git status
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
  # On branch master
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
  # Untracked files:
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
  #   (use "git add <file>..." to include in what will be committed)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
  #
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
  #       file
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
  nothing added to commit but untracked files present (use "git add" to track)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
or::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
  $ git reset badfile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
Doing changes.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
==============
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
  $ printf "clean:\n<TAB>rm $(wildcard *.o)\n" >>Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   123
  $ git diff
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
  diff --git a/Makefile b/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
  index e84f7e9..cd2438a 100644
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
  --- a/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
  +++ b/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
  @@ -1,2 +1,5 @@
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
   all:
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   130
          @echo XXX
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
          exit 1
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   132
  +
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   133
  +clean:
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   134
  +       rm -f *.o
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   135
    $ git add Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   136
    $ git commit -m "Added clean target."
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   137
  Created commit 11272b9: Added clean target.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   138
   1 files changed, 1 insertions(+), 0 deletions(-)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   139
   create mode 100644 file
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   140
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   141
or just::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   142
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
  $ git commit -a -m "Added clean target."
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   144
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   145
git analog of 'hg incoming'.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   146
============================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   147
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   148
git does not directly support such feature. You can emulate it by::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   149
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   150
  $ git fetch
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   151
  $ git log master..origin/master   # or just '..origin/master'
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   152
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   153
By previous commands you grab changes from remote server! You can apply them::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   154
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   155
  TODO
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   156
  $ git merge
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   157
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   158
git analog of 'hg outgoing'.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   159
============================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   160
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   161
git does not directly support such feature. You can emulate it by::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   162
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   163
  $ git fetch
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   164
  $ git log origin/master..master   # or just 'origin/master..'
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   165
1650
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   166
git analog of 'hg glog'.
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   167
========================
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   168
::
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   169
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   170
  $ git log --all --graph
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   171
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   172
Add alias::
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   173
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   174
  [alias]
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   175
  glog = log --all --graph
a48c3c61d0f9 git analog of 'hg glog'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1641
diff changeset
   176
1651
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   177
Git analog of 'hg rollback'.
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   178
============================
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   179
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   180
To edit commit message of last commit::
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   181
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   182
  $ git commit --amend -m "$MSG"
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   183
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   184
To edit messages of old commits starting from ``$REV``::
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   185
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   186
  $ git rebase -i $REV
c77807176b36 Git analog of 'hg rollback'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
   187
1771
b2d4be61da16 Git analog of 'hg root'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1714
diff changeset
   188
Git analog of 'hg root'.
b2d4be61da16 Git analog of 'hg root'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1714
diff changeset
   189
========================
b2d4be61da16 Git analog of 'hg root'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1714
diff changeset
   190
::
b2d4be61da16 Git analog of 'hg root'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1714
diff changeset
   191
b2d4be61da16 Git analog of 'hg root'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1714
diff changeset
   192
  $ git rev-parse --show-toplevel
b2d4be61da16 Git analog of 'hg root'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1714
diff changeset
   193
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   194
Debug git network operation.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   195
============================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   196
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   197
Git uses libcurl for network operation::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   198
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   199
  $ export GIT_CURL_VERBOSE=1
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   200
  $ git ...
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   201
1076
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   202
Push new repo to remote.
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   203
========================
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   204
::
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   205
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   206
  $ mkdir $REPO
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   207
  $ cd $REPO
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   208
  $ git init
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   209
  $ git add .
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   210
  $ git commit -m "Initial commit"
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   211
  $ git remote add origin https://$USER:$PASS@$HOST/$REPO
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   212
  $ git push -u origin master
9b2eb3c96d84 Push new repo to remote.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   213
1641
04e215a475e0 Show heads in branch.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
   214
Show heads in branch.
04e215a475e0 Show heads in branch.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
   215
=====================
04e215a475e0 Show heads in branch.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
   216
::
04e215a475e0 Show heads in branch.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
   217
04e215a475e0 Show heads in branch.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
   218
  $ git show-ref --heads -s
04e215a475e0 Show heads in branch.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
   219
1089
2c23dfe7517e Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1076
diff changeset
   220
Find most recent tag for revision.
2c23dfe7517e Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1076
diff changeset
   221
==================================
2c23dfe7517e Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1076
diff changeset
   222
::
2c23dfe7517e Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1076
diff changeset
   223
2c23dfe7517e Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1076
diff changeset
   224
  $ git describe $REV
2c23dfe7517e Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1076
diff changeset
   225
1815
49fb4309d4d0 Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1771
diff changeset
   226
Many projects set tags on branches rather then mainline (for example JS/CSS
49fb4309d4d0 Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1771
diff changeset
   227
projects perform build and commit binary/minified files, which unnecessary for
49fb4309d4d0 Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1771
diff changeset
   228
mainline history). In this case review simplifiied history by::
49fb4309d4d0 Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1771
diff changeset
   229
49fb4309d4d0 Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1771
diff changeset
   230
  $ git log --graph --all --decorate --oneline --simplify-by-decoration
49fb4309d4d0 Find most recent tag for revision.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1771
diff changeset
   231
1714
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   232
List tags with dates.
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   233
=====================
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   234
::
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   235
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   236
  $ git log --tags --simplify-by-decoration --pretty="format:%ci %d"
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   237
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   238
Update to date.
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   239
===============
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   240
::
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   241
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   242
  $ git checkout 'master@{1979-02-26}'
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   243
  $ git checkout 'master@{1979-02-26 18:30:00}'
eed8cfffa44e List tags with dates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
   244
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   245
Using git to work with SVN offline.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   246
===================================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   247
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   248
Prepare SVN and git utilities::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   249
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   250
  $ sudo apt-get svn git-core git-svn
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   251
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   252
Making SVN repo::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   253
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   254
    $ cd $HOME/tmp
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   255
    $ svnadmin create svn-repo
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   256
    $ svn co file://$HOME/tmp/svn-repo svn-devel
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   257
    $ cd svn-devel
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   258
    $ mkdir tags trunk branches
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   259
    $ svn add *
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   260
  A         branches
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   261
  A         tags
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   262
  A         trunk
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   263
    $ cd trunk/
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   264
    $ printf "all:\n  echo XXX\n" >Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   265
    $ printf "int main() {return 0;}" >main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   266
    $ svn add *
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   267
    $ cd ..
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   268
    $ svn st
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   269
  A      trunk
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   270
  A      trunk/main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   271
  A      trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   272
  A      branches
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   273
  A      tags
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   274
    $ svn ci -m init
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   275
  Adding         branches
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   276
  Adding         tags
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   277
  Adding         trunk
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   278
  Adding         trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   279
  Adding         trunk/main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   280
  Transmitting file data ..
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   281
    $ svn cp -m v0.0 file://$HOME/tmp/svn/trunk file://$HOME/tmp/svn/tags/v0.0
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   282
    $ svn cp -m v0.1 file://$HOME/tmp/svn/trunk file://$HOME/tmp/svn/branches/v0.1
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   283
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   284
Moving SVN changset to git repo::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   285
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   286
    $ cd $HOME/tmp
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   287
    $ git svn init file://$HOME/tmp/svn git-repo
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   288
    $ ls -a
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   289
  .  ..  .git
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   290
    $ git svn fetch
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   291
      A   trunk/main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   292
      A   trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   293
  W: +empty_dir: branches
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   294
  W: +empty_dir: tags
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   295
  r1 = 52ccd9882979dd53ec198dbac108783ec660410f (git-svn)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   296
      A   tags/v0.0/main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   297
      A   tags/v0.0/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   298
  r2 = 8ec8a772bb6f37ace56b3649066dc84e481ed427 (git-svn)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   299
      M   trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   300
  r3 = 2c169ff409ed504dd6a092b1e302beb3fd94871e (git-svn)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   301
      A   branches/v0.1/main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   302
      A   branches/v0.1/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   303
  r4 = e68d76f4ba6beea4b9059c1884c1f38ce10831a7 (git-svn)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   304
      M   trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   305
  r5 = cdde63974454b13ac53f2eeb201aa76c49fd875c (git-svn)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   306
  Checked out HEAD:
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   307
    file:///home/sasha/tmp/svn r5
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   308
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   309
or (in old git version)::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   310
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   311
  $ git svn clone file://$HOME/tmp/svn git-repo
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   312
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   313
Making changes in svn::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   314
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   315
    $ cd $HOME/tmp/svn-devel/trunk
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   316
    $ echo ".PHONY: clean" >>Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   317
    $ svn ci -m "Added clean to phony."
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   318
  Sending        trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   319
  Transmitting file data .
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   320
  Committed revision 6.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   321
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   322
Making committed in git::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   323
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   324
    $ cd $HOME/tmp/git-repo/trunk
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   325
    $ echo ".PHONY: all" >>Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   326
    $ echo "int foo(int x) {return x+x;}" >>main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   327
    $ git status
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   328
  # On branch master
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   329
  # Changed but not updated:
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   330
  #   (use "git add <file>..." to update what will be committed)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   331
  #
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   332
  #       modified:   Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   333
  #       modified:   main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   334
  #
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   335
  no changes added to commit (use "git add" and/or "git commit -a")
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   336
    $ git commit -a -m "Bug fixed."
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   337
  Created commit 222d399: Bug fixed.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   338
   2 files changed, 2 insertions(+), 0 deletions(-)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   339
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   340
Getting changes from SVN to git::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   341
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   342
    $ git svn rebase
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   343
      M   trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   344
  r6 = 8165e9bfb38e9df09a7313d19606ec227629b670 (git-svn)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   345
  First, rewinding head to replay your work on top of it...
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   346
  Applying Bug fixed.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   347
  error: patch failed: trunk/Makefile:6
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   348
  error: trunk/Makefile: patch does not apply
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   349
  Using index info to reconstruct a base tree...
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   350
  Falling back to patching base and 3-way merge...
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   351
  Auto-merged trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   352
  CONFLICT (content): Merge conflict in trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   353
  Failed to merge in the changes.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   354
  Patch failed at 0001.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   355
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   356
  When you have resolved this problem run "git rebase --continue".
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   357
  If you would prefer to skip this patch, instead run "git rebase --skip".
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   358
  To restore the original branch and stop rebasing run "git rebase --abort".
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   359
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   360
  rebase refs/remotes/git-svn: command returned error: 1
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   361
    $ git add Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   362
    $ git rebase --continue
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   363
  Applying Bug fixed.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   364
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   365
and return all from git to SVN::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   366
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   367
    $ git svn dcommit
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   368
  Committing to file:///home/sasha/tmp/svn ...
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   369
      M   trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   370
      M   trunk/main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   371
  Committed r7
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   372
      M   trunk/main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   373
      M   trunk/Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   374
  r7 = 68e782c8d06635f2db4dd69b9ca8599f99da22e2 (git-svn)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   375
  No changes between current HEAD and refs/remotes/git-svn
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   376
  Resetting to the latest refs/remotes/git-svn
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   377
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   378
See what going to SVN repo::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   379
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   380
    $ cd $HOME/tmp/svn-devel/trunk
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   381
    $ svn diff -r BASE:HEAD
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   382
  Index: Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   383
  ===================================================================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   384
  --- Makefile    (working copy)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   385
  +++ Makefile    (revision 7)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   386
  @@ -6,4 +6,4 @@
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   387
   .o: .c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   388
      $(CC) $(CFLAGS) -c -o $@ $<
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   389
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   390
  -.PHONY: clean
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   391
  +.PHONY: all clean
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   392
  Index: main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   393
  ===================================================================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   394
  --- main.c  (working copy)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   395
  +++ main.c  (revision 7)
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   396
  @@ -2,3 +2,4 @@
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   397
   {
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   398
       return 0;
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   399
   }
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   400
  +int foo(int x) {return x+x;}
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   401
    $ svn up
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   402
  U    Makefile
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   403
  U    main.c
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   404
  Updated to revision 7.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   405
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   406
gitk.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   407
=====
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   408
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   409
gitk - The git repository browser. See gitk(1).
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   410
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   411
Installing::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   412
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   413
  $ sudo apt-get instal gitk
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   414
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   415
Using::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   416
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   417
  $ cd /path/to/git-repo
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   418
  $ gitk
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   419