1CG-SWITCH(1)                                                      CG-SWITCH(1)
2
3
4

NAME

6       cg-switch - switch the working tree to a different (or new) local
7       branch
8

SYNOPSIS

10       cg-switch [-f] [-l | -n | -p] [-c | -r COMMIT_ID] BRANCH
11
12

DESCRIPTION

14       cg-switch(1) can switch your current local branch (and working copy) to
15       an existing branch, or create a new branch based on a given commit.
16
17       Terminology note: This command concerns local branches (also called
18       "heads"), not remote branches (those managed by cg-branch-add(1)).
19
20       Note that cg-switch(1) is meant for permanent switching of your current
21       local branch (permanent in the sense that you are going to work on it;
22       you can obviously cg-switch(1) again later). If you want to just
23       casually explore the current state of a particular branch of commit,
24       use cg-seek(1).
25
26

OPTIONS

28       -c     Create a new branch of given name, based on your current commit
29              (HEAD). This option is equivalent to specifying -r HEAD. If -f
30              is passed and the branch already exists, it is forcibly
31              repointed to point to the current commit.
32
33       -f     Force the branch's head pointer to be updated to whatever you
34              passed as the -r argument even if the branch already exists.
35              WARNING: The pointer to the original contents of the branch will
36              be lost! The contents itself will not be deleted right away,
37              git-fsck-objects --unreachable might help you to find it.
38              Besides, this can get very troublesome if you are pushing the
39              branch out - please refer to the documentation of a close
40              relative, cg-admin-uncommit(1).
41
42       -l     If your working tree has uncommitted local changes, the default
43              behaviour is that the changes will be reapplied to the new
44              branch after switching. With this option, however, the local
45              changes will be "kept" with your previous branch, you will get a
46              pristine tree of the new branch and when you switch back to the
47              original branch you will also get back the local changes. (You
48              do not need to pass any special switches when switching back, -l
49              has effect only on the branch you are switching _away_ from.)
50
51       -n     Do not switch your current branch to the given branch. This will
52              make cg-switch to only create or update the branch, but leave
53              your working copy alone.
54
55       -p     Do not touch the working copy when switching. This _will_ switch
56              your current branch, but the checked out working copy will have
57              the original contents kept (so further cg-diff(1) will list a
58              lot of changes, relative to the new branch).
59
60       -r COMMIT_ID
61              Point the branch at the given commit. Required when creating a
62              new branch. When switching to an existing branch, the branch
63              pointer is modified if -r is passed and confirmed by -f.
64
65       -h, --help
66              Print usage summary.
67
68       --long-help
69              Print user manual. The same as found in cg-switch(1).
70

EXAMPLE USAGE

72       To create a "v1.x" branch based on the commit "v1.0" and switch the
73       working copy to it, making it your current branch, do:
74
75
76       $ cg-switch -r v1.0 v1.x
77       If you want to create the branch (let's say based on the current
78       commit) but don't switch your working copy to it (so that your current
79       branch stays the same as before), do:
80
81
82       $ cg-switch -n -c v1.x
83       If you want to go back to the master branch, just do:
84
85
86       $ cg-switch master
87       To change the "v1.x" branch to refer to the latest commit on the
88       "testing" branch, do (WARNING: you will lose the pointer to the
89       original contents of the "v1.x" branch, be careful!):
90
91
92       $ cg-switch -f -r testing v1.x
93
95       Copyright © Yann Dirson, Petr Baudis 2005
96
97

SEE ALSO

99       cg-switch is part of cogito(7), a toolkit for managing git(7) trees.
100
101
102
103
104                                  12/11/2006                      CG-SWITCH(1)
Impressum