gawkworkflow: Repo Copies
1
1 2.2 How Git Stores Branches and Their Copies
1 ============================================
1
1 So how does Git work?(1)
1
1 A repository consists of a collection of "branches". Each branch
1 represents the history of a collection of files and directories (a file
1 "tree"). Each combined set of changes to this collection (files and
1 directories added or deleted, and/or file contents changed) is termed a
1 "commit".
1
1 When you first create a local copy of a remote repository ("clone the
1 repo"), Git copies all of the original repository's branches to your
1 local system. The original remote repository is referred to as being
1 "upstream", and your local repo is "downstream" from it. Git
1 distinguishes branches from the upstream repo by prefixing their names
1
1 +======================+
1 | Branches |
1 +======================+
1 | master |
1 +----------------------+
1 | gawk-4.1-stable |
1 +----------------------+
1 | gawk-4.0-stable |
1 +----------------------+
1 | feature/fix-comments |
1 +----------------------+
1 | ... |
1 +----------------------+
1
1 Figure 2.1: The Savannah 'gawk' Repository
1
1 After you clone the repo, on your local system you will have a single
1 branch named 'master' that's visible when you use 'git branch' to see
1 your branches.
1
1 $ git clone http://git.savannah.gnu.org/r/gawk.git Clone the repo
1 $ cd gawk Change to local copy
1 $ git branch See branch information
1 -| * master
1
1 The current branch is always indicated with a leading asterisk ('*').
1
1 Pictorially, the local repo looks like ⇒Figure 2.2 your-repo.
1 (you can ignore the 'T' column for the moment):
1
1 +===+======================++=============================+
1 | T | Local Branches || Remote Branches |
1 +===+======================++=============================+
1 | X | master || origin/master |
1 +---+----------------------++-----------------------------+
1 | | || origin/gawk-4.1-stable |
1 +---+----------------------++-----------------------------+
1 | | || origin/gawk-4.0-stable |
1 +---+----------------------++-----------------------------+
1 | | || origin/feature/fix-comments |
1 +---+----------------------++-----------------------------+
1 | | || ... |
1 +---+----------------------++-----------------------------+
1
1 Figure 2.2: Your Local 'gawk' Repository
1
1 Note that what is simply 'gawk-4.1-stable' in the upstream repo is now
1 referred to as 'origin/gawk-4.1-stable'. The 'origin/' branches are a
1 snapshot of the state of the upstream repo. This is how Git allows you
1 to see what changes you've made with respect to the upstream repo,
1 without having to actually communicate with the upstream repo over the
1 Internet. (When files are identical, Git is smart enough to not have
1 two separate physical copies on your local disk.)
1
1 If you're working on a simple bug fix or change, you can do so
1 directly in your local 'master' branch. You can then commit your
1 changes, and if you have access rights, push them upstream to the
1 Savannah repo. (However, there is a process to follow. Please read the
1 rest of this Info file.)
1
1 ---------- Footnotes ----------
1
1 (1) The following description is greatly simplified.
1