summaryrefslogtreecommitdiff
path: root/03/vc-mode.org
blob: ad888e9404e1949605cb80a02834b9f9178e3a82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#+title: Exploring VC
* What is VC
  
  VC is Emacs'default version-control integration. It is a framework
  that supports multiple backends such as:

  - Git
  - Bazaar
  - Subversion
  - CVS
  - more...

We'll review 2 workflows, one with _git_ and one with _svn_.

* Git

  The typical git workflow consists of:
  
  - Creating a repo
  - Creating a feature branch
  - Adding files
  - Coding
  - Commiting
  - Pushing

** Creating a repo

   To create a repo, start by editing files in a new directory. Hop in
   and hit =C-x v i=. You'll be asked to choose a backend. Select
   =git= and your project will be initialised.

** Create a feature branch

   Hit the combo =C-u C-x v v= to create a new branch. Enter the
   branch name you wish. Once created, the branch will not yet be
   checked out. Do =C-x v r= to choose your newly created branch.

** Adding files

   Create the files as usual and code into them. To add to version
   control, hit =C-x v i=.

** Committing

   To commit /the current file/, use VC's magical /"next step"/ command =C-x v v= and
   enter the commit information.

   To commit more than one change in one go, open up the /VC Dir/ with
   =C-x v d=. Then mark all changes you want to commit together with
   =m= (like in dired) and commit with =v=.

** Pushing

   Push by typing =C-x P=.

** Pulling

   You can push remote changes by using =C-x v +=.

* SVN

  The typical git workflow consists of:
  
  - Pulling changes
  - Adding files
  - Coding
  - Commiting

** Adding files

   Create the files as usual and code into them. To add to version
   control, hit =C-x v i=.

** Committing

   To commit /the current file/, use VC's magical /"next step"/ command =C-x v v= and
   enter the commit information.

   To commit more than one change in one go, open up the /VC Dir/ with
   =C-x v d=. Then mark all changes you want to commit together with
   =m= (like in dired) and commit with =v=.

** Pushing

   Push by typing =C-x P=.

** Pulling

   You can push remote changes by using =C-x v +=.

* Common actions

** View logs

   To view the project log, hit =C-x v ==.

** Blame

   To annotate a file (git blame), type =C-x v g=.