Changes between Version 11 and Version 12 of GitMigrationProposal
- Timestamp:
- 03/15/09 10:15:21 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GitMigrationProposal
v11 v12 130 130 = A first few git specific workflows = 131 131 132 Before showing a few simple but powerful git-specific workflows, we need to talk about two features of git. One, branches, is not specific to git, but the index concept is, and a basic understanding is necessary for most git-specific workflows. 133 132 134 == The branch concept == 133 135 … … 137 139 * branches are isolated: if you work on a non trivial feature, having a separate branch means you can commit regularly on it, without pushing things into the "trunk". In particular, you can break things without disturbing anyone else. 138 140 * branches are a useful unit of decomposition. Although it still certainly makes sense to commit things directly into the main line of development, regularly using separate branches is a good way to split tasks. This is especially useful for reviews: having a separate branch means everyone can easily look at those changes only. The examples will obviously make this clearer. 141 142 == The index and content-oriented tracking == 143 144 In the simple scenarios, we mentioned the '-a' option as necessary to commit all changes. That's because in git, you have to explicitly say which changes you want in a commit. Although a minor inconvenience in simple cases, this is extremely useful in advanced cases, especially for complex merges (to deal with conflict). This is linked to the fundamental idea that git tracks content, and not files. When you do 145 146 {{{ 147 git add foo.c 148 }}} 149 150 You are not really adding the file foo.c to the repository, but you add its content to the git repository. 139 151 140 152 == Scenario 1: creating a new branch == … … 155 167 }}} 156 168 157 Now, every commit will happen in the newbranch. Again, as for commits, the branch is only created in your repository, and not propagated to the repository, unless you explicitly push for it:169 Now, every commit will be put in newbranch. Again, as for commits, the branch is only created in your repository, and not propagated to the remote repository, unless you explicitly push for it: 158 170 159 171 {{{ … … 188 200 Note the difference between '..' and '...'. '..' (2 dots) is the same as a space. 189 201 202 == Scenario 3: Merging branches == 203 204 Merging branches is easy: 205 206 {{{ 207 # Will merge branch1 into the current branch 208 git merge branch1 209 }}} 190 210 = Rationale for git = 191 211
