Next: , Previous: , Up: Development without commit access   [Contents][Index]

4.3 Starting A New Branch

Let’s say you want to work on a new feature. For example, you might decide to add Python syntax support.5 You should create a new branch on which to work. First, switch back to master:

$ make distclean
$ git checkout master

Now, create a new branch. The easiest way to do that is with the -b option to ‘git checkout’:

$ git checkout -b feature/python
-| ...

You now do massive amounts of work in order to add Python syntax support. As you do each defined chunk of work, you update the ChangeLog file with your changes before committing them to the repo.

Let’s say you’ve added a new file python.c and updated several others. Use ‘git status’ to see what’s changed:

$ git status
-| ...

Before committing the current set of changes, you can use ‘git diff’ to view the changes. You may also use ‘git difftool6 to run an external diff command, such as meld on GNU/Linux:

$ git diff                           Regular built-in tool
$ git difftool --tool=meld           GUI diff tool

When you’re happy with the changes, use ‘git add’ to tell Git which of the changed and/or new files you wish to have ready to be committed:

$ git add ...

Use ‘git status’ to see that your changes are scheduled for committing:

$ git status

Now you can commit your changes to your branch:

$ git commit

Running ‘git commit’ causes Git to invoke an editor (typically from the $EDITOR environment variable) in which you can compose a commit message. Please supply a short message summarizing the commit. This message will be visible via ‘git log’.



Just joking. Please don’t attempt this for real.


Don’t run ‘git difftool’ in the background; it works interactively.

Next: , Previous: , Up: Development without commit access   [Contents][Index]