100% found this document useful (1 vote)
4 views

Pragmatic Version Control Using Git Travis Swicegood instant download

The document provides information about the book 'Pragmatic Version Control Using Git' by Travis Swicegood, which serves as a guide for beginners to learn Git and its functionalities. It includes reader testimonials praising the book's clarity and usefulness in understanding version control. Additionally, the document lists other related books available for download on the same platform.

Uploaded by

kuzakgaliezc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
4 views

Pragmatic Version Control Using Git Travis Swicegood instant download

The document provides information about the book 'Pragmatic Version Control Using Git' by Travis Swicegood, which serves as a guide for beginners to learn Git and its functionalities. It includes reader testimonials praising the book's clarity and usefulness in understanding version control. Additionally, the document lists other related books available for download on the same platform.

Uploaded by

kuzakgaliezc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Pragmatic Version Control Using Git Travis

Swicegood download

https://ebookbell.com/product/pragmatic-version-control-using-
git-travis-swicegood-4645460

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Pragmatic Version Control Using Subversion 2nd Ed Mike Mason

https://ebookbell.com/product/pragmatic-version-control-using-
subversion-2nd-ed-mike-mason-926532

Pragmatic Version Control Using Subversion 1st Edition Mike Mason

https://ebookbell.com/product/pragmatic-version-control-using-
subversion-1st-edition-mike-mason-1021154

Agile Web Development With Rails 4th Edition Beta 10 Version Fourth
Edition Sam Ruby

https://ebookbell.com/product/agile-web-development-with-rails-4th-
edition-beta-10-version-fourth-edition-sam-ruby-2031134

Practices Of An Agile Developer Working In The Real World 1 Book


Version P60august 2011 Venkat Subramaniam

https://ebookbell.com/product/practices-of-an-agile-developer-working-
in-the-real-world-1-book-version-p60august-2011-venkat-
subramaniam-38436440
Your Code As A Crime Scene Use Forensic Techniques To Arrest Defects
Bottlenecks And Bad Design In Your Programs 2 Book Version P10february
2024 Adam Tornhill

https://ebookbell.com/product/your-code-as-a-crime-scene-use-forensic-
techniques-to-arrest-defects-bottlenecks-and-bad-design-in-your-
programs-2-book-version-p10february-2024-adam-tornhill-56694874

Pragmatic Testdriven Development In C And Net Write Loosely Coupled


Documented And Highquality Code With Ddd Using Familiar Tools And
Libraries 1st Edition Adam Tibi

https://ebookbell.com/product/pragmatic-testdriven-development-in-c-
and-net-write-loosely-coupled-documented-and-highquality-code-with-
ddd-using-familiar-tools-and-libraries-1st-edition-adam-tibi-46473346

Pragmatic Thinking And Learning Andrew Hunt

https://ebookbell.com/product/pragmatic-thinking-and-learning-andrew-
hunt-47032922

Pragmatic Judgments In Direct Patient Care Moral Theory At The


Beginning Of Clinical Ethics Consultation Bernhard Bleyer

https://ebookbell.com/product/pragmatic-judgments-in-direct-patient-
care-moral-theory-at-the-beginning-of-clinical-ethics-consultation-
bernhard-bleyer-49152564

Pragmatic Studies In Judaism Andrew Schumann Editor

https://ebookbell.com/product/pragmatic-studies-in-judaism-andrew-
schumann-editor-49454610
What readers are saying about Pragmatic Version Control
Using Git

Pragmatic Version Control Using Git is an excellent guide to getting you


started with Git. It will teach you not only how to get yourself started
but also how to cooperate with others and how to keep your history
clean.
Pieter de Bie
Author, GitX

If you are thinking of using Git, I highly recommend this book. If you
are not using a version control system (and code or create content on
a computer), put the book down, slap yourself, pick the book back up,
and buy it.
Jacob Taylor
Entrepreneur and Cofounder, SugarCRM Inc.

Not only has this book convinced me that Git has something to offer
over CVS and Subversion, but it has also showed me how I can benefit
from using it myself even if I’m using it alone in a CVS/Subversion
environment. I expect to be a full-time Git user soon after reading
this, which is hard to believe considering this is the first distributed
version control system I’ve ever looked at.
Chuck Burgess
2008 PEAR Group Member

Travis has done an excellent job taking a tricky subject and making it
accessible, useful, and relevant. You’ll find distributed version control
and Git much less mysterious after reading this book.
Mike Mason
Author, Pragmatic Version Control Using Subversion
Pragmatic Version Control
Using Git

Travis Swicegood

The Pragmatic Bookshelf


Raleigh, North Carolina Dallas, Texas
Many of the designations used by manufacturers and sellers to distinguish their prod-
ucts are claimed as trademarks. Where those designations appear in this book, and The
Pragmatic Programmers, LLC was aware of a trademark claim, the designations have
been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The
Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g
device are trademarks of The Pragmatic Programmers, LLC.

Every precaution was taken in the preparation of this book. However, the publisher
assumes no responsibility for errors or omissions, or for damages that may result from
the use of information (including program listings) contained herein.

Our Pragmatic courses, workshops, and other products can help you and your team
create better software and have more fun. For more information, as well as the latest
Pragmatic titles, please visit us at

http://www.pragprog.com

Copyright © 2008 Travis Swicegood.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmit-


ted, in any form, or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior consent of the publisher.

Printed in the United States of America.

ISBN-10: 1-934356-15-8
ISBN-13: 978-1-934356-15-9
Printed on acid-free paper.
P2.0 printing, March 2009
Version: 2009-4-20
Contents
Acknowledgments 9

Preface 10
Who’s This Book For? . . . . . . . . . . . . . . . . . . . . . . . 11
What’s in This Book? . . . . . . . . . . . . . . . . . . . . . . . . 11
Typographic Conventions . . . . . . . . . . . . . . . . . . . . . 13
Online Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 13

I Welcome to the Distributed World 14

1 Version Control the Git Way 15


1.1 The Repository . . . . . . . . . . . . . . . . . . . . . . . . 16
1.2 What Should You Store? . . . . . . . . . . . . . . . . . . 17
1.3 Working Trees . . . . . . . . . . . . . . . . . . . . . . . . 18
1.4 Manipulating Files and Staying in Sync . . . . . . . . . 18
1.5 Tracking Projects, Directories, and Files . . . . . . . . . 19
1.6 Tracking Milestones with Tags . . . . . . . . . . . . . . 20
1.7 Creating Alternate Histories with Branches . . . . . . . 21
1.8 Merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.9 Locking Options . . . . . . . . . . . . . . . . . . . . . . . 24
1.10 Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . 25

2 Setting Up Git 26
2.1 Installing Git . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.2 Configuring Git . . . . . . . . . . . . . . . . . . . . . . . 31
2.3 Using Git’s GUI . . . . . . . . . . . . . . . . . . . . . . . 33
2.4 Accessing Git’s Built-in Help . . . . . . . . . . . . . . . . 34
CONTENTS 6

3 Creating Your First Project 36


3.1 Creating a Repository . . . . . . . . . . . . . . . . . . . . 37
3.2 Making Changes . . . . . . . . . . . . . . . . . . . . . . . 37
3.3 Starting to Work with a Project . . . . . . . . . . . . . . 40
3.4 Using and Understanding Branches . . . . . . . . . . . 43
3.5 Handling Releases . . . . . . . . . . . . . . . . . . . . . . 44
3.6 Cloning a Remote Repository . . . . . . . . . . . . . . . 48

II Everyday Git 50

4 Adding and Committing: Git Basics 51


4.1 Adding Files . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.2 Committing Changes . . . . . . . . . . . . . . . . . . . . 55
4.3 Seeing What Has Changed . . . . . . . . . . . . . . . . . 58
4.4 Managing Files . . . . . . . . . . . . . . . . . . . . . . . . 61

5 Understanding and Using Branches 65


5.1 What Are Branches? . . . . . . . . . . . . . . . . . . . . 66
5.2 Creating a New Branch . . . . . . . . . . . . . . . . . . . 67
5.3 Merging Changes Between Branches . . . . . . . . . . . 69
5.4 Handling Conflicts . . . . . . . . . . . . . . . . . . . . . 74
5.5 Deleting Branches . . . . . . . . . . . . . . . . . . . . . . 77
5.6 Renaming Branches . . . . . . . . . . . . . . . . . . . . 78

6 Working with Git’s History 80


6.1 Inspecting Git’s Log . . . . . . . . . . . . . . . . . . . . . 81
6.2 Specifying Revision Ranges . . . . . . . . . . . . . . . . 82
6.3 Looking at Differences Between Versions . . . . . . . . 85
6.4 Finding Out Who’s to Blame . . . . . . . . . . . . . . . . 86
6.5 Following Content . . . . . . . . . . . . . . . . . . . . . . 88
6.6 Undoing Changes . . . . . . . . . . . . . . . . . . . . . . 91
6.7 Rewriting History . . . . . . . . . . . . . . . . . . . . . . 94

7 Working with Remote Repositories 100


7.1 Network Protocols . . . . . . . . . . . . . . . . . . . . . . 100
7.2 Cloning a Remote Repository . . . . . . . . . . . . . . . 103
7.3 Keeping Up-to-Date . . . . . . . . . . . . . . . . . . . . . 104
7.4 Pushing Changes . . . . . . . . . . . . . . . . . . . . . . 105
7.5 Adding New Remote Repositories . . . . . . . . . . . . . 106

Report erratum
this copy is (P2.0 printing, March 2009)
CONTENTS 7

8 Organizing Your Repository 109


8.1 Marking Milestones with Tags . . . . . . . . . . . . . . . 110
8.2 Handling Release Branches . . . . . . . . . . . . . . . . 112
8.3 Using Valid Names for Tags and Branches . . . . . . . 114
8.4 Tracking Multiple Projects . . . . . . . . . . . . . . . . . 115
8.5 Using Git Submodules to Track External Repositories . 116

9 Beyond the Basics 122


9.1 Compacting Repository History . . . . . . . . . . . . . . 123
9.2 Exporting Your Repository . . . . . . . . . . . . . . . . . 124
9.3 Rebasing a Branch . . . . . . . . . . . . . . . . . . . . . 125
9.4 Using the Reflog . . . . . . . . . . . . . . . . . . . . . . . 128
9.5 Bisecting Your Repository . . . . . . . . . . . . . . . . . 131

III Administration 135

10 Migrating to Git 136


10.1 Communicating with SVN . . . . . . . . . . . . . . . . . 136
10.2 Making Sure git-svn Is Available . . . . . . . . . . . . . 140
10.3 Importing a Subversion Repository . . . . . . . . . . . . 141
10.4 Keeping Up-to-Date with a Subversion Repository . . . 143
10.5 Pushing Changes to SVN . . . . . . . . . . . . . . . . . . 145
10.6 Importing from CVS . . . . . . . . . . . . . . . . . . . . . 146

11 Running a Git Server with Gitosis 147


11.1 Making Sure Dependencies Are Met . . . . . . . . . . . 148
11.2 Installing Gitosis . . . . . . . . . . . . . . . . . . . . . . 149
11.3 Creating Administrator Credentials . . . . . . . . . . . . 149
11.4 Configuring the Server for Gitosis . . . . . . . . . . . . . 150
11.5 Initializing Gitosis . . . . . . . . . . . . . . . . . . . . . . 151
11.6 Configuring Gitosis . . . . . . . . . . . . . . . . . . . . . 151
11.7 Adding New Repositories . . . . . . . . . . . . . . . . . . 152
11.8 Setting Up a Public Repository . . . . . . . . . . . . . . 154
11.9 Closing Thoughts . . . . . . . . . . . . . . . . . . . . . . 155

Report erratum
this copy is (P2.0 printing, March 2009)
CONTENTS 8

IV Appendixes 157

A Git Command Quick Reference 158


A.1 Setup and Initialization . . . . . . . . . . . . . . . . . . . 158
A.2 Normal Usage . . . . . . . . . . . . . . . . . . . . . . . . 159
A.3 Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
A.4 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
A.5 Remote Repositories . . . . . . . . . . . . . . . . . . . . 164
A.6 Git to SVN Bridge . . . . . . . . . . . . . . . . . . . . . . 165

B Other Resources and Tools 167


B.1 Extras Bundled with Git . . . . . . . . . . . . . . . . . . 167
B.2 Third-Party Tools . . . . . . . . . . . . . . . . . . . . . . 168
B.3 Git Repository Hosting . . . . . . . . . . . . . . . . . . . 171
B.4 Online Resources . . . . . . . . . . . . . . . . . . . . . . 172

C Bibliography 174

Index 175

Report erratum
this copy is (P2.0 printing, March 2009)
Acknowledgments
Although my name is on this book as the author, it is only here because
of a long list of people. Please indulge me while I take a moment to thank
them.
Thanks to Dave Thomas and Andy Hunt for taking the chance on a new
author. The entire team they’ve put together at Pragmatic Bookshelf is
amazing. I owe a special thanks to my editor, the ever helpful Susannah
Davidson Pfalzer.
I would also like to thank all of those who offered me feedback on the
book as it progressed through beta form. Especially helpful was the
great team of technical reviewers: Chuck Burgess, Pieter de Bie, Stu-
art Halloway, Junio Hamano, Chris Hartjes, Mike Mason, John Mertic,
Gary Sherman, Jacob Taylor, and Tommi “Tv” Virtanen. Thanks also
to the wonderful teams of developers and colleagues at SugarCRM and
Ning who supported me while I wrote this book.
Finally, I would like to thank my friends and family for their support
and understanding while I wrote this book. My wonderful wife, Meg,
put up with the late nights and “work weekends” with very little com-
plaining. Without her support, and that from the rest of my friends and
family, this book wouldn’t be here today.
Preface
Development teams around the globe are changing. They are dropping
their clunky, old, centralized version control systems (VCSs) in favor of
Git, which is a lightweight, distributed version control system (DVCS)
and relative newcomer to the version control world.
First here’s a quick overview: a version control system is like a bank
vault. You take your valuables—in our case as developers, these valu-
ables are the source code we write—and deposit them in the bank
for safekeeping.1 Each change you mark—or commit—is recorded, and
you can go back over the history just like you can review your bank
statement.
In the Git world, it’s like you walk around with your own vault that
has an automated teller attached right to it. You can fully disconnect
from everyone else, share what you want, and of course keep track of
your project’s history. The brainchild of Linus Torvalds, Git was orig-
inally developed to track changes made to the Linux kernel. Git has
matured from the original rough collection of scripts Linus created in a
few weeks into a rich toolkit. Its following strengths can help you as a
programmer:
• Distributed architecture: Disconnect completely, and work without
the distractions of an always-on Internet connection.
• Easy branching and merging: Creating branches is easy, cheap,
and fast, and unlike some version control systems, merging every-
thing back together—even multiple times—is a snap.

1. As I write this, we’re in the middle of a $700 billion bailout of the American banking
system, so maybe a bank isn’t the best of analogies. Don’t think about that part; just
think of banks the way they’re supposed to work.
W HO ’ S T HIS B OOK F OR ? 11

• Subversion communication: Are you the only one in your company


ready to make the switch? No worries if everyone else is still using
Subversion. Git can import all your history from and send your
changes back to a Subversion repository.
That’s the sixty-second introduction to Git, and the rest of this book
will build on this simple foundation.

Who’s This Book For?


This book has something in it for everyone. If you’re new to version
control and the preceding paragraphs are all you know about it, this
book will walk you through the basics and get you up to speed on how
Git can help you.
If you’re a seasoned developer and have a firm grasp on Subversion or
CVS, you can skim Part I about Git specifics and jump into Part II to
get into the good stuff—the Git commands and how they work.

What’s in This Book?


This book is divided into four parts:
• Part I is an introduction to version control with a Git slant. Chap-
ter 1, Version Control the Git Way, on page 15 is where you’ll learn
about version control in general and some of the fundamental con-
cepts around VCS and how DVCS is different.
Chapter 2, Setting Up Git, on page 26 walks you through installing
and configuring Git, and Chapter 3, Creating Your First Project, on
page 36 gets your feet wet by working on a simple HTML project2
that showcases a lot of Git’s functionality in a real project.
Chapters 2 and 3 are hands-on, so have your computer handy.
• Part II is where the training wheels come off. Chapter 4, Adding
and Committing: Git Basics, on page 51 deals with the basics—
the commands you need to accomplish everyday tasks—getting a
repository started, making commits, and so on.
Next up, we jump into branches in Chapter 5, Understanding and
Using Branches, on page 65. Branching is so key to how Git oper-

2. Don’t worry if you don’t know HTML—our project is a simple one.

Report erratum
this copy is (P2.0 printing, March 2009)
W HAT ’ S IN T HIS B OOK ? 12

ates that there’s a full chapter explaining what branches are and
how to use them. With the first two chapters of Part II out of the
way, you’ll be ready to start exploring the history of changes you’ve
been creating. Chapter 6, Working with Git’s History, on page 80
covers that.
Chapter 7, Working with Remote Repositories, on page 100 introdu-
ces you to the concepts around sharing your work with others
through remote repositories. The “social” aspect of any version
control system is its killer feature, and Git is no different.
Once you know how to use Git and interact with other developers’
repositories, you’ll learn about some organizational techniques in
Chapter 8, Organizing Your Repository, on page 109 to keep your
repository sane.
Finally, we round out Part II with Chapter 9, Beyond the Basics,
on page 122, which introduces you to some commands you’ll find
useful for specialized situations.
These chapters all have lots of examples to follow along with, but
keep in mind they are jumping-off points for how to use Git to
work with your code’s history. Once you get more comfortable,
feel free to experiment.
• Part III is all about administration and is not required reading if
someone else on your team or in your company handles that for
you. Chapter 10, Migrating to Git, on page 136 shows you how to
handle migration to Git from other popular VCSs, and Chapter 11,
Running a Git Server with Gitosis, on page 147 teaches you how to
administer your public repositories with Gitosis.
• We close out with a few appendixes. In Appendix A, on page 158,
you’ll find a command reference so you can quickly find out how
to do common commands.
In Appendix B, on page 167, you’ll find coverage of some extra
tools—some that ship with Git and some of which you have to
install yourself—and links to online resources.
Finally, in Appendix C, on page 174, you’ll find information on
other books that are referenced throughout this one.

Report erratum
this copy is (P2.0 printing, March 2009)
T YPOGRAPHIC C ONVENTIONS 13

Typographic Conventions
A few typographical conventions are used throughout this book. They
are as follows:
Git Refers to the program as a whole when capitalized.
git Refers to the command you run on the command
line.
italic Signifies new concepts.
files and directories Are displayed in this font.
prompt> Comes before something you should type. Longer
commands may be broken up into several lines
with a \ at the end of each line. They can be typed
as one line. They’re broken up in the book only so
they fit on the page.

Online Resources
Each chapter in Part II starts with a repository that looks like your
repository does if you follow along with each of the examples throughout
the book. If you skip ahead, you can get a copy of the repository by
cloning it from GitHub. You can find the repositories on GitHub from
my profile:
http://github.com/tswicegood

The command you need to get the current repository is listed at the
start of each chapter.
The book’s web page on pragprog.com3 is a great jumping-off point for
what’s going on with the book. From there you can drop me a note on
the forums or make suggestions or corrections on the errata page.
At this point, I’m sure you’re teeming with questions. So, without fur-
ther ado, let’s jump into it!

3. http://www.pragprog.com/titles/tsgit

Report erratum
this copy is (P2.0 printing, March 2009)
Part I

Welcome to the Distributed


World

14
Chapter 1

Version Control the Git Way


A version control system (VCS) is a methodology or tool that helps you
keep track of changes you make to the files in your project. In its sim-
plest, manual form, a VCS is you creating a copy of the file you’re work-
ing with and adding the date and time to the end of it.
Being pragmatic, we want something that will help automate that pro-
cess. This is where VCS tools come in. They track all the changes for
us, keeping a copy of every change made to the code in our projects.
Distributed version control systems (DVCSs) are no different in that
respect. Their main goal is still to help us track changes we make to the
projects we’re working on. The difference between VCSs and DVCSs is
how developers communicate their changes to each other.
In this chapter, we’ll explore what a VCS is and how a DVCS—Git in
particular—is different from the traditional, centralized model. You’ll
learn the following:
• What a repository is
• How to determine what to store
• What working trees are
• How files are manipulated and how to stay in sync
• How to track projects, directories, and their files
• How to mark milestones with tags
• How to track an alternate history with a branch
• What merging is
• How Git handles locking
All of these ideas revolve around the repository, so let’s start there.
T HE R EPOSITORY 16

1.1 The Repository


The repository is the place where the version control system keeps track
of all the changes you make. Most VCSs store the current state of the
code, along with when each change was made, who made it, and a text
log message that explains why they made the change.
You can think of a repository like a bank vault and its history like the
ledger. Each time a deposit—what is called a commit in VCS lingo—is
made, your VCS tool adds an entry to the ledger and stores the changes
for safekeeping.
Originally, these repositories were accessible only if you were logged
directly into the machines they were stored on. That doesn’t scale, so
tools such as CVS, and later Subversion, were created. They allowed
developers to work remotely from the repository and send their changes
back using a network connection.
These systems follow a centralized repository model. That means there
is one central repository that everyone sends their changes to. Each
developer keeps a copy of the latest version of the repository, and when-
ever they make a change to it, they send that change back to the main
repository.
The centralized repository is an improvement over having to directly
access the machine where the repository lives, but it still has limita-
tions. First, you have only the latest version of the code. To look at the
history of changes, you have to ask the repository for that information.
That brings up the second problem. You have to be able to access the
remote repository—normally over a network.
In this age of always-on, broadband Internet connections, we forget that
sometimes we don’t have access to a network. As I’ve worked on this
book, I’ve written parts at my home office, in coffee shops, on cross-
country plane flights, and on the road (as a passenger) while traveling
across country. I even did some of the final editing at a rustic cabin in
Lake of the Ozarks, Missouri.
That highlights one of the biggest advantages of a DVCS, which is the
model that Git follows. Instead of having one central repository that
you and everyone else on your team sends changes to, you each have
your own repository that has the entire history of the project. Making
a commit doesn’t involve connecting to a remote repository; the change
is recorded in your local repository.

Report erratum
this copy is (P2.0 printing, March 2009)
W HAT S HOULD Y OU S TORE ? 17

Let’s go back to our bank vault analogy for a minute. A centralized


system is like having one bank that every developer on your team uses.
A distributed system is like each developer having their own personal
bank.
You might be wondering how you can keep in sync with everyone else’s
changes and make sure they have yours. Each developer still sends
their changes back to the main project repository. They can have access
to send the changes directly to the main repository (an action called
pushing in Git), or they might have to submit patches, which are small
sets of changes, to the project’s maintainer and have them update the
main repository.

1.2 What Should You Store?


The short answer: everything.
The slightly less short answer: everything that you need to work on
your project. Your repository needs a copy of everything in your project
that’s essential for you to modify, enhance, and build new versions of it.
The first and most obvious thing you should store in the repository is
your project’s source code. Without that, you can’t fix bugs or imple-
ment new features.
Most projects have some sort of build files. A couple of common ones
are Makefiles, Rakefiles, or Ant’s build.xml. These need to be stored so
you can compile your source code into something usable.
Other common items to store in your repository are sample configura-
tion files, documentation, images that are used in the application, and
of course unit tests.
Determining what to include is easy. Ask yourself, “If I didn’t have X,
could I do my work on this project?” If the answer is no, you couldn’t,
then it should be included.
Like all good rules, there is an exception. The rule doesn’t apply to tools
that you should use. You should include the Ant build.xml file but not
the entire Ant program.
It’s not a hard exception, though. Sometimes storing a copy of Ant or
JUnit or some other program in your repository can make sure the
entire team is using the same version of the tools you use. These should
be stored separately from your project, however.

Report erratum
this copy is (P2.0 printing, March 2009)
W ORKING T REES 18

1.3 Working Trees


So far we’ve discussed the repository and talked about all the files
you’re storing in it, but we haven’t talked about where you make all
of your changes. This happens in your working tree.
The working tree is your current view into the repository. It has all the
files from your project: the source code, build files, unit tests, and so on.
Some VCSs refer to this as your working copy. People coming to Git
for the first time from another VCS often have trouble separating the
working tree from the repository. In a VCS such as Subversion, your
repository exists “over there” on another server.
In Git, “over there” means in the .git/ directory inside your project’s
directory on your local computer. This means you can look at the his-
tory of the repository and see what has changed without having to com-
municate with a repository on another server.
So, how do you get this working tree in the first place? Well, you can
start your own project and then tell Git to initialize a repository for it;
or you can clone an existing repository.
Cloning makes a copy of another repository and then checks out a copy
of its master branch—its main line of development. Checking out is the
process Git uses to change your working tree to match a certain point in
the repository. We’ll talk more about cloning repositories in Section 7.2,
Cloning a Remote Repository, on page 103.
Of course, a VCS is all about tracking changes. So far, we’ve talked
about repositories and your working tree—your current view of the
repository—but we haven’t talked about those changes yet. Now we’ll
cover that.

1.4 Manipulating Files and Staying in Sync


Tracking changes to your files over time is the whole reason for using
a VCS. You make changes to the source code, rerun your unit tests to
make sure your changes don’t have any side effects, and then commit
those changes.
Committing a change adds a new revision to the repository and stores
your log message explaining what the change did. This gives you a
record to go back through if you ever need to figure out why a certain
change was made or when a bug was introduced.

Report erratum
this copy is (P2.0 printing, March 2009)
T RACKING P ROJECTS , D IRECTORIES , AND F ILES 19

A DVCS such as Git requires that you share your changes with other
developers in order for them to have access to them. This is done by
pushing the changes to an upstream repository.
An upstream repository is a public repository that you and possibly
other developers all push changes to. Pushing is what you do when you
want to send your data to another repository so it can be shared with
other developers.
Pushing changes is just half of what you need to do to stay in sync. You
also have to fetch changes to get the latest updates from other members
on your team.
There are two steps to retrieving changes from a remote Git repository.
First, you fetch them. That creates a copy of the remote repository’s
changes for you. This step is sort of like the reverse of pushing. Instead
of sending changes to another repository, you ask the remote repository
to send you the changes it has.
Next, you merge those changes into your local history. Git provides
tools that help you merge changes. Since you normally want to fetch
and merge changes at the same time, Git provides a way to do both
in one step through a process called pulling. Pulling is similar to an
update command in Subversion or CVS.
Git is fully distributed, though. You can push and pull changes to and
from multiple repositories. Working with remote repositories is a core
part of fully understanding how Git works. We’ll cover it fully in Chap-
ter 7, Working with Remote Repositories, on page 100.

1.5 Tracking Projects, Directories, and Files


So far you’ve seen how to store your code in repositories. In this section,
we’ll talk about how to organize the things you store.
At the lowest level, Git tracks the files you store in your repository as
content. This is different from many version control systems that track
files. Instead of tracking a models.py file, Git tracks the content—the
individual characters and lines that make up the variables, functions,
and so on—of models.py, and Git adds metadata to it such as the name,
file mode, and whether the file is a symlink. It’s a nuanced difference,
but it’s an important one.

Report erratum
this copy is (P2.0 printing, March 2009)
Another Random Document on
Scribd Without Any Related Topics
CHAPTER II

‘ECONOMIC’ AND ‘MORAL’ MOTIVES IN INTERNATIONAL AFFAIRS

The Great Illusion dealt—among other factors of international conflict—


with the means by which the population of the world is driven to support
itself; and studied the effect of those efforts to find sustenance upon the
relations of States. It therefore dealt with economics.
On the strength of this, certain critics (like some of those quoted in the
last chapter) who cannot possibly have read the book thoroughly, seem to
have argued: If this book about war deals with ‘economics,’ it must deal
with money and profits. To bring money and profits into a discussion of war
is to imply that men fight for money, and won’t fight if they don’t get
money from it; that war does not ‘pay.’ This is wicked and horrible. Let us
denounce the writer for a shallow Hedonist and money-grubber....
As a matter of simple fact, as we shall see presently, the book was
largely an attempt to show that the economic argument usually adduced for
a particularly ruthless form of national selfishness was not a sound
argument; that the commonly invoked justification for a selfish immoralism
in Foreign Policy was a fallacy, an illusion. Yet the critics somehow
managed to turn what was in fact an argument against national egoism into
an argument for selfishness.
What was the political belief and the attitude towards life which The
Great Illusion challenged? And what was the counter principle which it
advocated as a substitute therefore?
It challenged the theory that the vital interests of nations are conflicting,
and that war is part of the inevitable struggle for life among them; the view
that, in order to feed itself, a nation with an expanding population must
conquer territory and so deprive others of the means of subsistence; the
view that war is the ‘struggle for bread.’[101] In other words, it challenged
the economic excuse or justification for the ‘sacred egoism’ which is so
largely the basis of the nationalist political philosophy, an excuse, which, as
we shall see, the nationalist invokes if not to deny the moral law in the
international field, at least to put the morality governing the relations of
States on a very different plane from that which governs the relations of
individuals. As against this doctrine The Great Illusion advanced the
proposition, among others, that the economic or biological assumption on
which it is based is false; that the policy of political power which results
from this assumption is economically unworkable, its benefits an illusion;
that the amount of sustenance provided by the earth is not a fixed quantity
so that what one nation can seize another loses, but is an expanding
quantity, its amount depending mainly upon the efficiency with which men
co-operate in their exploitation of Nature. As already pointed out, a hundred
thousand Red Indians starved in a country where a hundred million modern
Americans have abundance. The need for co-operation, and the faith on
which alone it can be maintained, being indispensable to our common
welfare, the violation of the social compact, international obligation, will be
visited with penalties just as surely as are violations of the moral law in
relations between individuals. The economic factor is not the sole or the
largest element in human relations, but it is the one which occupies the
largest place in public law and policy. (Of two contestants, each can retain
his religion or literary preferences without depriving the other of like
possessions; they cannot both retain the same piece of material property.)
The economic problem is vital in the sense of dealing with the means by
which we maintain life; and it is invoked as justification for the political
immoralism of States. Until the confusions concerning it are cleared up, it
will serve little purpose to analyse the other elements of conflict.
What justifies the assumption that the predatory egotism, sacred or
profane, here implied, was an indispensable part of the pre-war political
philosophy, explaining the great part of policy in the international field?
[102]
First the facts: the whole history of international conflict in the decade or
two which preceded the War; and the terms of the Treaty of Versailles. If
you would find out the nature of a people’s (or a statesman’s) political
morality, note their conduct when they have complete power to carry their
desires into effect. The terms of peace, and the relations of the Allies with
Russia, show a deliberate and avowed pre-occupation with sources of oil,
iron, coal; with indemnities, investments, old debts; with Colonies, markets;
the elimination of commercial rivals—with all these things to a degree very
much greater and in a fashion much more direct than was assumed in The
Great Illusion.
But the tendency had been evident in the conflicts which preceded the
War. These conflicts, in so far as the Great Powers were concerned, had
been in practically every case over territory, or roads to territory; over
Madagascar, Egypt, Morocco, Korea, Mongolia; ‘warm water’ ports, the
division of Africa, the partitioning of China, loans thereto and concessions
therein; the Persian Gulf, the Bagdad Railway, the Panama Canal. Where
the principle of nationality was denied by any Great Power it was generally
because to recognise it might block access to the sea or raw materials,
throw a barrier across the road to undeveloped territory.
There was no denial of this by those who treated of public affairs. Mr
Lloyd George declared that England would be quite ready to go to war
rather than have the Morocco question settled without reference to her.
Famous writers like Mahan did not balk at conclusions like this:—
‘It is the great amount of unexploited raw material in territories
politically backward, and now imperfectly possessed by the nominal
owners, which at the present moment constitutes the temptation and the
impulse to war of European States.’[103]
Nor to justify them thus:—
‘More and more Germany needs the assured importation of raw
materials, and, where possible, control of regions productive of such
materials. More and more she requires assured markets, and security as to
the importation of food, since less and less comparatively is produced
within her own borders for her rapidly increasing population. This all means
security at sea.... Yet the supremacy of Great Britain in European seas
means a perpetually latent control of German commerce.... The world has
long been accustomed to the idea of a predominant naval power, coupling it
accurately with the name of Great Britain: and it has been noted that such
power, when achieved, is commonly found associated with commercial and
industrial pre-eminence, the struggle for which is now in progress between
Great Britain and Germany. Such pre-eminence forces a nation to seek
markets, and, where possible, to control them to its own advantage by
preponderant force, the ultimate expression of which is possession.... From
this flow two results: the attempt to possess, and the organisation of force
by which to maintain possession already achieved.... This statement is
simply a specific formulation of the general necessity stated; itself an
inevitable link in a chain of logical sequence: industry, markets, control,
navy, bases....[104]
Mr Spenser Wilkinson, of a corresponding English school, is just as
definite:—
‘The effect of growth is an expansion and an increase of power. It
necessarily affects the environment of the growing organisms; it interferes
with the status quo. Existing rights and interests are disturbed by the fact of
growth, which is itself a change. The growing community finds itself
hedged in by previously existing and surviving conditions, and fettered by
prescriptive rights. There is, therefore, an exertion of force to overcome
resistance. No process of law or of arbitration can deal with this
phenomenon, because any tribunal administering a system of right or law
must base its decision upon the tradition of the past which has become
unsuited to the new conditions that have arisen. The growing State is
necessarily expansive or aggressive.’[105]
Even more decisive as a definite philosophy are the propositions of Mr
Petre, who, writing on ‘The Mandate of Humanity,’ says:—
‘The conscience of a State cannot, therefore, be as delicate, as
disinterested, as altruistic, as that of the noblest individuals. The State exists
primarily for its own people and only secondarily for the rest of the world.
Hence, given a dispute in which it feels its rights and welfare to be at stake,
it may, however erroneously, set aside its moral obligations to international
society in favour of its obligations to the people for whom it exists.
‘But no righteous conscience, it may be said, could give its verdict
against a solemn pledge taken and reciprocated; no righteous conscience
could, in a society of nations, declare against the ends of that society.
Indeed I think it could, and sometimes would, if its sense of justice were
outraged, if its duty to those who were bone of its bone and flesh of its flesh
came into conflict with its duty to those who were not directly belonging to
it....
‘The mechanism of a State exists mainly for its own preservation, and
cannot be turned against this, its legitimate end. The conscience of a State
will not traverse this main condition, and to weaken its conscience is to
weaken its life....
‘The strong will not give way to the weak; the one who thinks himself in
the right will not yield to those whom he believes to be in the wrong; the
living generations will not be restrained by the promises to a dead one;
nature will not be controlled by conventions.’[106]
It is the last note that gives the key to popular feeling about the scramble
for territory. In The Great Illusion whole pages of popular writing are
quoted to show that the conception of the struggle as in truth the struggle
for survival had firmly planted itself in the popular consciousness. One of
the critics who is so severe upon the present writer for trying to undermine
the economic foundation of that popular creed, Benjamin Kidd, himself
testifies to the depth and sweep of this pseudo-Darwinism (he seems to
think indeed that it is true Darwinism, which it is not, as Darwin himself
pointed out). He declares that ‘there is no precedent in the history of the
human mind to compare with the saturnalia of the Western intellect’ which
followed the popularisation of what he regards as Darwin’s case and I
would regard as a distortion of it. Kidd says it ‘touched the profoundest
depth of the psychology of the West.’ ‘Everywhere throughout civilisation
an almost inconceivable influence was given to the doctrine of the law of
biological necessity in books of statecraft and war-craft, of expanding
military empires.’ ‘Struggle for life,’ ‘a biological necessity,’ ‘survival of
the fit,’ had passed into popular use and had come to buttress popular
feeling about the inevitability of war and its ultimate justification and the
uselessness of organising the natives save on a basis of conflict.
We are now in a position to see the respective moral positions of the two
protagonists.
The advocate of Political Theory No. 1, which an overwhelming
preponderance of evidence shows to be the prevailing theory, says:—You
Pacifists are asking us to commit national suicide; to sacrifice future
generations to your political ideals. Now, as voters or statesmen we are
trustees, we act for others. Sacrifice, suicide even, on behalf of an ideal,
may be justified when we are sacrificing ourselves. But we cannot sacrifice
others, our wards. Our first duty is to our own nation, our own children; to
their national security and future welfare. It is regrettable if, by the
conquests, wars, blockades, rendered necessary by those objects other
people starve, and lose their national freedom and see their children die; but
that is the hard necessity of life in a hard world.
Advocate of Political Theory No. 2 says:—I deny that the excuse of
justification which you give for your cruelty to others is a valid excuse or
justification. Pacifism does not ask you to sacrifice your people, to betray
the interest of your wards. You will serve their interests best by the policy
we advocate. Your children will not be more assured of their sustenance by
these conquests that attempt to render the feeding of foreign children more
difficult; yours will be less secure. By co-operating with those others
instead of using your energies against them, the resultant wealth....
Advocate No. 1:—Wealth! Interest! You introduce your wretched
economic calculations of interest into a question of Patriotism. You have the
soul of a bagman concerned only to restore ‘the blessed hour of tranquil
money-getting,’ and Sir William Robertson Nicoll shall denounce you in the
British Weekly!
And the discussion usually ends with this moral flourish and gestures of
melodramatic indignation.
But are they honest gestures? Here are the upholders of a certain position
who say:—‘In certain circumstances as when you are in a position of
trustee, the only moral course, the only right course, is to be guided by the
interests of your ward. Your duty then demands a calculation of advantage.
You may not be generous at your ward’s expense. This is the justification of
the “sacred egoism” of the poet.’
If in that case a critic says: ‘Very well. Let us consider what will be the
best interests of your ward,’ is it really open to the first party to explain in a
paroxysm of moral indignation: ‘You are making a shameful and
disgraceful appeal to selfishness and avarice?’
This is not an attempt to answer one set of critics by quoting another set.
The self-same people take those two attitudes. I have quoted above a
passage of Admiral Mahan’s in which he declares that nations can never be
expected to act from any other motive than that of interest (a generalisation,
by the way, from which I should most emphatically dissent). He goes on to
declare that Governments ‘must put first the rival interests of their own
wards ... their own people,’ and are thus pushed to the acquisition of
markets by means of military predominance.
Very well. The Great Illusion argued some of Admiral Mahan’s
propositions in terms of interest and advantage. And then, when he desired
to demolish that argument, he did not hesitate in a long article in the North
American Review to write as follows:—
‘The purpose of armaments, in the minds of those maintaining them, is
not primarily an economical advantage, in the sense of depriving a
neighbour State of its own, or fear of such consequences to itself through
the deliberate aggression of a rival having that particular end in view.... The
fundamental proposition of the book is a mistake. Nations are under no
illusion as to the unprofitableness of war in itself.... The entire conception
of the work is itself an illusion, based upon a profound misreading of
human action. To regard the world as governed by self-interest only is to
live in a non-existent world, an ideal world, a world possessed by an idea
much less worthy than those which mankind, to do it bare justice,
persistently entertains.’[107]
Admiral Mahan was a writer of very great and deserved reputation, in
the very first rank of those dealing with the relations of power to national
politics, certainly incapable of any conscious dishonesty of opinion. Yet, as
we have seen, his opinion on the most important fact of all about war—its
ultimate purpose, and the reasons which justify it or provoke it—swings
violently in absolute self-contradiction. And the flat contradiction here
revealed shows—and this surely is the moral of such an incident—that he
could never have put to himself detachedly, coldly, impartially the question:
‘What do I really believe about the motives of nations in War? To what do
the facts as a whole really point?’ Had he done so, it might have been
revealed to him that what really determined his opinion about the causes of
war was a desire to justify the great profession of arms, to one side of which
he had devoted his life and given years of earnest labour and study; to
defend from some imputation of futility one of the most ancient of man’s
activities that calls for some at least of the sublimest of human qualities. If a
widened idealism clearly discredited that ancient institution, he was
prepared to show that an ineradicable conflict of national interests rendered
it inevitable. If it was shown that war was irrelevant to those conflicts, or
ineffective as a means of protecting the interests concerned, he was
prepared to show that the motives pushing to war were not those of interest
at all.
It may be said that none the less the thesis under discussion substitutes
one selfish argument for another; tries by appealing to self-interest (the self-
interest of a group or nation) to turn selfishness from a destructive result to
a more social result. Its basis is self. Even that is not really true. For, first,
that argument ignores the question of trusteeship; and, secondly, it involves
a confusion between the motive of a given policy and the criterion by which
its goodness or badness shall be tested.
How is one to deal with the claim of the ‘mystic nationalist’ (he exists
abundantly even outside the Balkans) that the subjugation of some
neighbouring nationalism is demanded by honour; that only the great State
can be the really good State; that power—‘majesty,’ as the Oriental would
say—is a thing good in itself?[108] There are ultimate questions as to what
is good and what is bad that no argument can answer; ultimate values which
cannot be discussed. But one can reduce those unarguable values to a
minimum by appealing to certain social needs. A State which has plenty of
food may not be a good State; but a State which cannot feed its population
cannot be a good State, for in that case the citizens will be hungry, greedy,
and violent.
In other words, certain social needs and certain social utilities—which
we can all recognise as indispensables—furnish a ground of agreement for
the common action without which no society can be established. And the
need for such a criterion becomes more manifest as we learn more of the
wonderful fashion in which we sublimate our motives. A country refuses to
submit its dispute to arbitration, because its ‘honour’ is involved. Many
books have been written to try and find out precisely what honour of this
kind is. One of the best of them has decided that it is anything which a
country cares to make it. It is never the presence of coal, or iron, or oil,
which makes it imperative to retain a given territory: it is honour (as Italy’s
Foreign Minister explained when Italy went to war for the conquest of
Tripoli). Unfortunately, rival States have also impulses of honour which
compel them to claim the same undeveloped territory. Nothing can prove—
or disprove—that honour, in such circumstances, is invoked by each or
either of the parties concerned to make a piece of acquisitiveness or
megalomania appear as fine to himself as possible: that, just because he has
a lurking suspicion that all is not well with the operation, he seeks to justify
it to himself with fine words that have a very vague content. But on this
basis there can be no agreement. If, however, one shifts the discussion to
the question of what is best for the social welfare of both, one can get a
modus vivendi. For each to admit that he has no right so to use his power as
to deprive the other of means of life, would be the beginning of a code
which could be tested. Each might conceivably have that right to deprive
the other of means of livelihood, if it were a choice between the lives of his
own people or others.
The economic fact is the test of the ethical claim: if it really be true that
we must withhold sources of food from others because otherwise our own
would starve, there is some ethical justification for such use of our power. If
such is not the fact, the whole moral issue is changed, and with it, to the
degree to which it is mutually realised, the social outlook and attitude. The
knowledge of interdependence is part, at least, of an attitude which makes
the ‘social sense’—the sense that one kind of arrangement is fair and
workable, and another is not. To bring home the fact of this interdependence
is not simply an appeal to selfishness: it is to reveal a method by which an
apparently irreconcilable conflict of vital needs can be reconciled. The
sense of interdependence, of the need of one for another, is part of the
foundation of the very difficult art of living together.
Much mischief arises from the misunderstanding of the term ‘economic
motive.’ Let us examine some further examples of this. One is a common
confusion of terms: an economic motive may be the reverse of selfish. The
long sustained efforts of parents to provide fittingly for their children—
efforts continued, it may be, through half a lifetime—are certainly
economic. Just as certainly they are not selfish in any exact sense of the
term. Yet something like this confusion seems to overlie the discussion of
economics in connection with war.
Speaking broadly, I do not believe that men ever go to war from a cold
calculation of advantage or profit. I never have believed it. It seems to me
an obvious and childish misreading of human psychology. I cannot see how
it is possible to imagine a man laying down his life on the battle-field for
personal gain. Nations do not fight for their money or interests, they fight
for their rights, or what they believe to be their rights. The very gallant men
who triumphed at Bull Run or Chancellorsville were not fighting for the
profits on slave-labour: they were fighting for what they believed to be their
independence: the rights, as they would have said, to self-government or, as
we should now say, of self-determination. Yet it was a conflict which arose
out of slave labour: an economic question. Now the most elementary of all
rights, in the sense of the first right which a people will claim, is the right to
existence—the right of a population to bread and a decent livelihood.[109]
For that nations certainly will fight. Yet, as we see, it is a right which arises
out of an economic need or conflict. We have seen how it works as a factor
in our own foreign policy: as a compelling motive for the command of the
sea. We believe that the feeding of these islands depends upon it: that if we
lost it our children might die in the streets and the lack of food compel us to
an ignominious surrender. It is this relation of vital food supply to
preponderant sea power which has caused us to tolerate no challenge to the
latter. We know the part which the growth of the German Navy played in
shaping Anglo-Continental relations before the War; the part which any
challenge to our naval preponderance has always played in determining our
foreign policy. The command of the sea, with all that that means in the way
of having built up a tradition, a battle-cry in politics, has certainly bound up
with it this life and death fact of feeding our population. That is to say it is
an economic need. Yet the determination of some millions of Englishmen to
fight for this right to life, to die rather than see the daily bread of their
people in jeopardy, would be adequately described by some phrase about
Englishmen going to war because it ‘paid.’ It would be a silly or dishonest
gibe. Yet that is precisely the kind of gibe that I have had to face these
fifteen years in attempting to disentangle the forces and motives underlying
international conflict.
What picture is summoned to our minds by the word ‘economics’ in
relation to war? To the critics whose indignation is so excited at the
introduction of the subject at all into the discussion of war—and they
include, unhappily, some of the great names of English literature
—‘economic’ seems to carry no picture but that of an obese Semitic
stockbroker, in quaking fear for his profits. This view cannot be said to
imply either much imagination or much sense of reality. For among the
stockbrokers, the usurers, those closest to financial manipulation and in
touch with financial changes, are to be found some groups numerically
small, who are more likely to gain than to lose by war; and the present
writer has never suggested the contrary.
But the ‘economic futility’ of war expresses itself otherwise: in half a
Continent unable to feed or clothe or warm itself; millions rendered
neurotic, abnormal, hysterical by malnutrition, disease, and anxiety;
millions rendered greedy, selfish, and violent by the constant strain of
hunger; resulting in ‘social unrest’ that threatens more and more to become
sheer chaos and confusion: the dissolution and disintegration of society.
Everywhere, in the cities, are the children who cry and who are not fed,
who raise shrunken arms to our statesmen who talk with pride[110] of their
stern measures of ‘rigorous’ blockade. Rickety and dying children, and
undying hate for us, their murderers, in the hearts of their mothers—these
are the human realities of the ‘economics of war.’
The desire to prevent these things, to bring about an order that would
render possible both patriotism and mercy, would save us from the dreadful
dilemma of feeding our own children only by the torture and death of others
equally innocent—the effort to this end is represented as a mere appeal to
selfishness and avarice, something mean and ignoble, a degradation of
human motive.
‘These theoretical dilemmas do not state accurately the real conditions of
politics,’ the reader may object. ‘No one proposes to inflict famine as a
means of enforcing our policy’ ... ‘England does not make war on women
and children.’
Not one man or woman in a million, English or other, would wittingly
inflict the suffering of starvation upon a single child, if the child were
visible to his eyes, present in his mind, and if the simple human fact were
not obscured by the much more complex and artificial facts that have
gathered round our conceptions of patriotism. The heaviest indictment of
the military-nationalist philosophy we are discussing is that it manages
successfully to cover up human realities by dehumanising abstractions.
From the moment that the child becomes a part of that abstraction
—‘Russia,’ ‘Austria,’ ‘Germany’—it loses its human identity, and becomes
merely an impersonal part of the political problem of the struggle of our
nation with others. The inverted moral alchemy, by which the golden
instinct that we associate with so much of direct human contact is
transformed into the leaden cruelty of nationalist hate and high statecraft,
has been dealt with at the close of Part I. When in tones of moral
indignation it is declared that Englishmen ‘do not make war on women and
children,’ we must face the truth and say that Englishmen, like all peoples,
do make such war.
An action in public policy—the proclamation of the blockade, or the
confiscation of so much tonnage, or the cession of territory, or the refusal of
a loan—these things are remote and vague; not only is the relation between
results and causes remote and sometimes difficult to establish, but the
results themselves are invisible and far away. And when the results of a
policy are remote, and can be slurred over in our minds, we are perfectly
ready to apply, logically and ruthlessly, the most ferocious of political
theories. It is of supreme importance then what those theories happen to be.
When the issue of war and peace hangs in the balance, the beam may well
be kicked one way or the other by our general political philosophy, these
somewhat vague and hazy notions about life being a struggle, and nature
red of tooth and claw, about wars being part of the cosmic process,
sanctioned by professors and bishops and writers. It may well be these
vague notions that lead us to acquiesce in the blockade or the newest war.
The typhus or the rickets do not kill or maim any the less because we do not
in our minds connect those results with the political abstractions that we
bandy about so lightly. And we touch there the greatest service which a
more ‘economic’ treatment of European problems may perform. If the
Treaty of Versailles had been more economic it would also have been a
more humane and human document. If there had been more of Mr Keynes
and less of M. Clemenceau, there would have been not only more food in
the world, but more kindliness; not only less famine, but less hate; not only
more life, but a better way of life; those living would have been nearer to
understanding and discarding the way of death.
Let us summarise the points so far made with reference to the
‘economic’ motive.
We need not accept any hard and fast (and in the view of the present
writer, unsound) doctrine of economic determinism, in order to admit the
truth of the following:—
1. Until economic difficulties are so far solved as to give the mass of the
people the means of secure and tolerable physical existence, economic
considerations and motives will tend to exclude all others. The way to give
the spiritual a fair chance with ordinary men and women is not to be
magnificently superior to their economic difficulties, but to find a solution
for them. Until the economic dilemma is solved, no solution of moral
difficulties will be adequate. If you want to get rid of the economic
preoccupation, you must solve the worst of the economic problem.
2. In the same way the solution of the economic conflict between nations
will not of itself suffice to establish peace; but no peace is possible until that
conflict is solved. That makes it of sufficient importance.
3. The ‘economic’ problem involved in international politics the use of
political power for economic ends—is also one of Right, including the most
elemental of all rights, that to exist.
4. The answer which we give to that question of Right will depend upon
our answer to the actual query of The Great Illusion: must a country of
expanding population expand its territory or trade by means of its political
power, in order to live? Is the political struggle for territory a struggle for
bread?
5. If we take the view that the truth is contained in neither an unqualified
affirmative nor an unqualified negative, then all the more is it necessary that
the interdependence of peoples, the necessity for a truly international
economy, should become a commonplace. A wider realisation of those facts
would help to create that pre-disposition necessary for a belief in the
workability of voluntary co-operation, a belief which must precede any
successful attempt to make such co-operation the basis of an international
order.
6. The economic argument of The Great Illusion, if valid, destroys the
pseudo-scientific justification for political immoralism, the doctrine of State
necessity, which has marked so much of classical statecraft.
7. The main defects of the Treaty of Versailles are due to the pressure of
a public opinion obsessed by just those ideas of nations as persons, of
conflicting interests, which The Great Illusion attempted to destroy. If the
Treaty had been inspired by the ideas of interdependence of interest, it
would have been not only more in the interests of the Allies, but morally
sounder, providing a better ethical basis for future peace.
8. To go on ignoring the economic unity and interdependence of Europe,
to refuse to subject nationalist pugnacities to that needed unity because
‘economics’ are sordid, is to refuse to face the needs of human life, and the
forces that shape it. Such an attitude, while professing moral elevation,
involves a denial of the right of others to live. Its worst defect, perhaps, is
that its heroics are fatal to intellectual rectitude, to truth. No society built
upon such foundations can stand.
CHAPTER III

THE GREAT ILLUSION ARGUMENT

THE preceding chapters have dealt rather with misconceptions concerning


The Great Illusion than with its positive propositions. What, outlined as
briefly as possible, was its central argument?

That argument was an elaboration of these propositions: Military


preponderance, conquest, as a means to man’s most elemental needs—
bread, sustenance—is futile, because the processes (exchange, division of
labour) to which the dense populations of modern Western society are
compelled to resort, cannot be exacted by military coercion; they can only
operate as the result of a large measure of voluntary acquiescence by the
parties concerned. A realisation of this truth is indispensable for the restraint
of the instinctive pugnacities that hamper human relationship, particularly
where nationalism enters.[111] The competition for power so stimulates
those pugnacities and fears, that isolated national power cannot ensure a
nation’s political security or independence. Political security and economic
well-being can only be ensured by international co-operation. This must be
economic as well as political, be directed, that is, not only at pooling
military forces for the purpose of restraining aggression, but at the
maintenance of some economic code which will ensure for all nations,
whether militarily powerful or not, fair economic opportunity and means of
subsistence.
It was, in other words, an attempt to clear the road to a more workable
international policy by undermining the main conceptions and
prepossessions inimical to an international order.[112] It did not elaborate
machinery, but the facts it dealt with point clearly to certain conclusions on
that head.
While arguing that prevailing beliefs (false beliefs for the most part) and
feelings (largely directed by the false beliefs) were the determining factors
in international politics, the author challenged the prevailing assumption of
the unchangeability of those ideas and feelings, particularly the proposition
that war between human groups arises out of instincts and emotions
incapable of modification or control or re-direction by conscious effort. The
author placed equal emphasis on both parts of the proposition—that dealing
with the alleged immutability of human pugnacity and ideas, and that which
challenged the representation of war as an inevitable struggle for physical
sustenance—if only because no exposure of the biological fallacy would be
other than futile if the former proposition were true.[113]
If conduct in these matters is the automatic reaction to uncontrollable
instinct and is not affected by ideas, or if ideas themselves are the mere
reflection of that instinct, obviously it is no use attempting demonstrations
of futility, economic or other. The more we demonstrate the intensity of our
inherent pugnacity and irrationalism, the more do we in fact demonstrate
the need for the conscious control of those instincts. The alternative
conclusion is fatalism: an admission not only that our ship is not under
control, but that we have given up the task of getting it under control. We
have surrendered our freedom.
Moreover, our record shows that the direction taken by our pugnacities
—their objective—is in fact largely determined by traditions and ideas
which are in part at least the sum of conscious intellectual effort. The
history of religious persecution—its wars, inquisitions, repressions—shows
a great change (which we must admit as a fact, whether we regard it as
good or bad) not only of idea but of feeling.[114] The book rejected instinct
as sufficient guide and urged the need of discipline by intelligent foresight
of consequence.
To examine our subconscious or unconscious motives of conduct is the
first step to making them conscious and modifying them.
This does not imply that instincts—whether of pugnacity or other—can
readily be repressed by a mere effort of will. But their direction, the object
upon which they expend themselves, will depend upon our interpretation of
facts. If we interpret the hailstorm or the curdled milk in one way, our fear
and hatred of the witch is intense; the same facts interpreted another way
make the witch an object of another emotion, pity.
Reason may be a very small part of the apparatus of human conduct
compared with the part played by the unconscious and subconscious, the
instinctive and the emotional. The power of a ship’s compass is very small
indeed compared with the power developed by the engines. But the greater
the power of the engines, the greater will be the disaster if the relatively tiny
compass is deflected and causes the ship to be driven on to the rocks. The
illustration indicates, not exactly but with sufficient truth, the relationship of
‘reason’ to ‘instinct.’
The instincts that push to self-assertion, to the acquisition of
preponderant power, are so strong that we shall only abandon that method
as the result of perceiving its futility. Co-operation, which means a
relationship of partnership and give and take, will not succeed till force has
failed.
The futility of power as a means to our most fundamental and social
ends is due mainly to two facts, one mechanical, and the other moral. The
mechanical fact is that if we really need another, our power over him has
very definite limits. Our dependence on him gives him a weapon against us.
The moral fact is that in demanding a position of domination, we ask
something to which we should not accede if it were asked of us: the claim
does not stand the test of the categorical imperative. If we need another’s
labour, we cannot kill him; if his custom, we cannot forbid him to earn
money. If his labour is to be effective, we must give him tools, knowledge;
and these things can be used to resist our exactions. To the degree to which
he is powerful for service he is powerful for resistance. A nation wealthy as
a customer will also be ubiquitous as a competitor.
The factors which have operated to make physical compulsion (slavery)
as a means of obtaining service less economical than service for reward,
operate just as effectively between nations. The employment of military
force for economic ends is an attempt to apply indirectly the principle of
chattel-slavery to groups; and involves the same disadvantages.[115]
In so far as coercion represents a means of securing a wider and more
effective social co-operation as against a narrower social co-operation, or
more anarchic condition, it is likely to be successful and to justify itself
socially. The imposition of Western government upon backward peoples
approximates to the role of police; the struggles between the armed forces
of rival Western Powers do not. The function of a police force is the exact
contrary to that of armies competing with one another.[116]
The demonstration of the futility of conquest rested mainly on these
facts. After conquest the conquered people cannot be killed. They cannot be
allowed to starve. Pressure of population on means of subsistence has not
been reduced, but probably increased, since the number of mouths to fill
eliminated by the casualty lists is not equivalent to the reduced production
occasioned by war. To impose by force (e.g. exclusion from raw materials)
a lower standard of living, creates (a) resistance which involves costs of
coercion (generally in military establishments, but also in the political
difficulties in which the coercion of hostile peoples—as in Alsace-Lorraine
and Ireland—generally involves their conqueror), costs which must be
deducted from the economic advantage of the conquest; and (b) loss of
markets which may be indispensable to countries (like Britain) whose
prosperity depends upon an international division of labour. A population
that lives by exchanging its coal and iron for (say) food, does not profit by
reducing the productivity of subject peoples engaged in food production.
In The Great Illusion the case was put as follows:—
‘When we conquer a nation in these days, we do not exterminate it: we
leave it where it was. When we “overcome” the servile races, far from
eliminating them, we give them added chances of life by introducing order,
etc., so that the lower human quality tends to be perpetuated by conquest by
the higher. If ever it happens that the Asiatic races challenge the white in the
industrial or military field, it will be in large part thanks to the work of race
conservation, which has been the result of England’s conquest in India,
Egypt, and Asia generally.’—(pp. 191-192.)
‘When the division of labour was so little developed that every
homestead produced all that it needed, it mattered nothing if part of the
community was cut off from the world for weeks and months at a time. All
the neighbours of a village or homestead might be slain or harassed, and no
inconvenience resulted. But if to-day an English county is by a general
railroad strike cut off for so much as forty-eight hours from the rest of the
economic organism, we know that whole sections of its population are
threatened with famine. If in the time of the Danes England could by some
magic have killed all foreigners, she would presumably have been the better
off. If she could do the same thing to-day half her population would starve
to death. If on one side of the frontier a community is, say, wheat-
producing, and on the other coal-producing, each is dependent for its very
existence on the fact of the other being able to carry on its labour. The
miner cannot in a week set to and grow a crop of wheat; the farmer must
wait for his wheat to grow, and must meantime feed his family and
dependents. The exchange involved here must go on, and each party have
fair expectation that he will in due course be able to reap the fruits of his
labour, or both starve; and that exchange, that expectation, is merely the
expression in its simplest form of commerce and credit; and the
interdependence here indicated has, by the countless developments of rapid
communication, reached such a condition of complexity that the
interference with any given operation affects not merely the parties directly
involved, but numberless others having at first sight no connection
therewith.
‘The vital interdependence here indicated, cutting athwart frontiers, is
largely the work of the last forty years; and it has, during that time, so
developed as to have set up a financial interdependence of the capitals of
the world, so complex that disturbance in New York involves financial and
commercial disturbance in London, and, if sufficiently grave, compels
financiers of London to co-operate with those of New York to put an end to
the crisis, not as a matter of altruism, but as a matter of commercial self-
protection. The complexity of modern finance makes New York dependent
on London, London upon Paris, Paris upon Berlin, to a greater degree than
has ever yet been the case in history. This interdependence is the result of
the daily use of those contrivances of civilisation which date from yesterday
—the rapid post, the instantaneous dissemination of financial and
commercial information by means of telegraphy, and generally the
incredible progress of rapidity in communication which has put the half-
dozen chief capitals of Christendom in closer contact financially, and has
rendered them more dependent the one upon the other than were the chief
cities of Great Britain less than a hundred years ago.—(pp. 49-50.)
‘Credit is merely an extension of the use of money, and we can no more
shake off the domination of the one than we can of the other. We have seen
that the bloodiest despot is himself the slave of money, in the sense that he
is compelled to employ it. In the same way no physical force can in the
modern world set at naught the force of credit. It is no more possible for a
great people of the modern world to live without credit than without money,
of which it is a part.... The wealth of the world is not represented by a fixed
amount of gold or money now in the possession of one Power, and now in
the possession of another, but depends on all the unchecked multiple
activities of a community for the time being. Check that activity, whether
by imposing tribute, or disadvantageous commercial conditions, or an
unwelcome administration which sets up sterile political agitation, and you
get less wealth—less wealth for the conqueror, as well as less for the
conquered. The broadest statement of the case is that all experience—
especially the experience indicated in the last chapter—shows that in trade
by free consent carrying mutual benefit we get larger results for effort
expended than in the exercise of physical force which attempts to exact
advantage for one party at the expense of the other.’—(pp. 270-272.)
In elaboration of this general thesis it is pointed out that the processes of
exchange have become too complex for direct barter, and can only take
place by virtue of credit; and it is by the credit system, the ‘sensory nerve’
of the economic organism, that the self-injurious results of economic war
are first shown. If, after a victorious war, we allow enemy industry and
international trade to go on much as before, then obviously our victory will
have had very little effect on the fundamental economic situation. If, on the
other hand, we attempt for political or other reasons to destroy our enemy’s
industry and trade, to keep him from the necessary materials of it, we
should undermine our own credit by diminishing the exchange value of
much of our own real wealth. For this reason it is ‘a great illusion’ to
suppose that by the political annexation of colonies, territories with iron-
mines, coal-mines, we enrich ourselves by the amount of wealth their
exploitation represents.[117]
The large place which such devices as an international credit system
must take in our international economy, adds enormously to the difficulty of
securing any ‘spoils of victory’ in the shape of indemnity. A large indemnity
is not impossible, but the only condition on which it can be made possible
—a large foreign trade by the defeated people—is not one that will be
readily accepted by the victorious nation. Yet the dilemma is absolute: the
enemy must do a big foreign trade (or deliver in lieu of money large
quantities of goods) which will compete with home production, or he can
pay no big indemnity—nothing commensurate with the cost of modern war.
Since we are physically dependent on co-operation with foreigners, it is
obvious that the frontiers of the national State are not co-terminous with the
frontiers of our society. Human association cuts athwart frontiers. The
recognition of the fact would help to break down that conception of nations
as personalities which plays so large a part in international hatred. The
desire to punish this or that ‘nation’ could not long survive if we had in
mind, not the abstraction, but the babies, the little girls, old men, in no way
responsible for the offences that excited our passions, whom we treated in
our minds as a single individual.[118]
As a means of vindicating a moral, social, religious, or cultural ideal—as
of freedom or democracy—war between States, and still more between
Alliances, must be largely ineffective for two main reasons. First, because
the State and the moral unit do not coincide. France or the British Empire
could not stand as a unit for Protestanism as opposed to Catholicism,
Christianity as opposed to Mohammedanism, or Individualism as opposed
to Socialism, or Parliamentary Government as opposed to Bureaucratic
Autocracy, or even for European ascendancy as against Coloured Races.
For both Empires include large coloured elements; the British Empire is
more Mohammedan than Christian, has larger areas under autocratic than
under Parliamentary government; has powerful parties increasingly
Socialistic. The State power in both cases is being used, not to suppress, but
to give actual vitality to the non-Christian or non-European or coloured
elements that it has conquered. The second great reason why it is futile to
attempt to use the military power of States for ends such as freedom and
democracy, is that the instincts to which it is compelled to appeal, the spirit
it must cultivate and the methods it is compelled increasingly to employ, are
themselves inimical to the sentiment upon which freedom must rest.
Nations that have won their freedom as the result of military victory,
usually employ that victory to suppress the freedom of others. To rest our
freedom upon a permanent basis of nationalist military power, is equivalent
to seeking security from the moral dangers of Prussianism by organising
our States on the Prussian model.
Our real struggle is with nature: internecine struggles between men
lessen the effectiveness of the human army. A Continent which supported
precariously, with recurrent famine, a few hundred thousand savages
fighting endlessly between themselves, can support, abundantly a hundred
million whites who can manage to maintain peace among themselves and
fight nature.
Nature here includes human nature. Just as we turn the destructive forces
of external nature from our hurt to our service, not by their unintelligent
defiance, but by utilising them through a knowledge of their qualities, so
can the irrepressible but not ‘undirectable’ forces of instinct, emotion,
sentiment, be turned by intelligence to the service of our greatest and most
permanent needs.
CHAPTER IV

ARGUMENTS NOW OUT OF DATE

FOR the purposes of simplicity and brevity the main argument of The Great
Illusion assumed the relative permanence of the institution of private
property in Western society, and the persistence of the tendency of
victorious belligerents to respect it, a tendency which had steadily grown in
strength for five hundred years. The book assumed that the conqueror
would do in the future what he has done to a steadily increasing degree in
the past, especially as the reasons for such policy, in terms of self-interest,
have so greatly grown in force during the last generation or two. To have
argued its case in terms of non-existent and hypothetical conditions which
might not exist for generations or centuries, would have involved
hopelessly bewildering complications. And the decisive reason for not
adding this complication was the fact that though it would vary the form of
the argument, it would not effect the final conclusion.
As already explained in the first part of this book (Chapter II) this war
has marked a revolution in the position of private property and the relation
of the citizen to the State. The Treaty of Versailles departs radically from
the general principles adhered to, for instance, in the Treaty of Frankfurt;
the position of German traders and that of the property of German citizens
does not at all to-day resemble the position in which the Treaty of Frankfurt
left the French trader and French private property.
The fact of the difference has already been entered into at some length. It
remains to see how the change affects the general argument adopted in The
Great Illusion.
It does not affect its final conclusions. The argument ran: A conqueror
cannot profit by ‘loot’ in the shape of confiscations, tributes, indemnities,
which paralyse the economic life of the defeated enemy. They are
economically futile. They are unlikely to be attempted, but if they are
attempted they will still be futile.[119]
Events have confirmed that conclusion, though not the expectation that
the enemy’s economic life would be left undisturbed. We have started a
policy which does injure the economic life of the enemy. The more it
injures him, the less it pays us. And we are abandoning it as rapidly as
nationalist hostilities will permit us. In so far as pre-war conditions pointed
to the need of a definitely organised international economic code, the
situation created by the Treaty has only made the need more visible and
imperative. For, as already explained in the first Part, the old
understandings enabled industry to be built up on an international basis; the
Treaty of Versailles and its confiscations, prohibitions, controls, have
destroyed those foundations. Had that instrument treated German trade and
industry as the Germans treated French in 1871 we might have seen a
recovery of German economic life relatively as rapid as that which took
place in France during the ten years which followed her defeat. We should
not to-day be faced by thirty or forty millions in Central and Eastern Europe
without secure means of livelihood.
The present writer confesses most frankly—and the critics of The Great
Illusion are hereby presented with all that they can make of the admission—
that he did not expect a European conqueror, least of all Allied conquerors,
to use their victory for enforcing a policy having these results. He believed
that elementary considerations of self-interest, the duty of statesmen to
consider the needs of their own countries just emerging from war, would
stand in the way of a policy of this kind. On the other hand, he was under
no illusions as to what would result if they did attempt to enforce that
policy. Dealing with the damage that a conqueror might inflict, the book
says that such things as the utter destruction of the enemy’s trade
could only be inflicted by an invader as a means of punishment costly to
himself, or as the result of an unselfish and expensive desire to inflict
misery for the mere joy of inflicting it. In this self-seeking world it is not
practical to assume the existence of an inverted altruism of this kind.—(p.
29.)
Because of the ‘interdependence of our credit-built finance and industry’
the confiscation by an invader of private property, whether stocks, shares,
ships, mines, or anything more valuable than jewellery or furniture—
anything, in short, which is bound up with the economic life of the people
—would so react upon the finance of the invader’s country as to make the
damage to the invader resulting from the confiscation exceed in value the
property confiscated—(p. 29).
Speaking broadly and generally, the conqueror in our day has before him
two alternatives: to leave things alone, and in order to do that he need not
have left his shores; or to interfere by confiscation in some form, in which
case he dries up the source of the profit which tempted him—(p. 59).
All the suggestions made as to the economic futility of such a course—
including the failure to secure an indemnity—have been justified.[120]
In dealing with the indemnity problem the book did forecast the
likelihood of special trading and manufacturing interests within the
conquering nation opposing the only condition upon which a very large
indemnity would be possible—that condition being either the creation of a
large foreign trade by the enemy or the receipt of payment in kind, in goods
which would compete with home production. But the author certainly did
not think it likely that England and France would impose conditions so
rapidly destructive of the enemy’s economic life that they—the conquerors
—would, for their own economic preservation, be compelled to make loans
to the defeated enemy.
Let us note the phase of the argument that the procedure adopted renders
out of date. A good deal of The Great Illusion was devoted to showing that
Germany had no need to expand territorially; that her desire for overseas
colonies was sentimental, and had little relation to the problem of providing
for her population. At the beginning of 1914 that was certainly true. It is not
true to-day. The process by which she supported her excess population
before the War will, to put it at its lowest, be rendered extremely difficult of
maintenance as the result of allied action. The point, however, is that we are
not benefiting by this paralysis of German industry. We are suffering very
greatly from it: suffering so much that we can be neither politically nor
economically secure until this condition is brought to an end. There can be
no peace in Europe, and consequently no safety for us or France, so long as
we attempt by power to maintain a policy which denies to millions in the
midst of our civilisation the possibility of earning their living. In so far as
the new conditions create difficulties which did not originally exist, our
victory does but the more glaringly demonstrate the economic futility of our
policy towards the vanquished.
An argument much used in The Great Illusion as disproving the claims
made for conquest was the position of the population of small States. ‘Very
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like