3

I have a master branch and would like to create a new branch based on it, and then switch to the new branch.

I'm very very new to coda/github/terminal so I don't even know if my syntax is correct. here's what I typed in, letter for letter, with the exception of the branch names which are placeholders:

git checkout -b $newbranchname $oldbranchname

This was the suggested format based on the github cheatsheet seen here: http://bit.ly/WXRGN

unfortunately I get this error message: fatal: Not a git repository (or any of the parent directories): .git

Please help, I really have no idea what's going on. Do I need to be pointing to a directory or something in the branch name? Any info is much appreciated

Abizern
  • 146,289
  • 39
  • 203
  • 257
pc-mac
  • 31
  • 1
  • 2
  • Can you tell me, in which directory you executed this command? And please indent your code by 4 spaces in order to let the syntax highlighter do it's work. – fuz Sep 19 '10 at 03:42
  • I prefer to leave indents for code formatting and the > operator to mark unstyled text such as this – Abizern Sep 19 '10 at 03:53
  • 1
    Have you tried a `git status` to make sure that you are in a repository? – Abizern Sep 19 '10 at 03:54
  • i tried git status and still get 'fatal: not a git repository' error. how do i go about fixing this? – pc-mac Sep 19 '10 at 03:57
  • Are you running your commands in the same directory as the `.git` folder of your project? – Abizern Sep 19 '10 at 04:04
  • Did you correctly `init` the repo? is it as clone? – Abizern Sep 19 '10 at 04:06

1 Answers1

2

Use cd to move into the directory, where your repo is.

Like

$ ls
foo bar baz myRepo
$ cd myRepo
$ ls -a
src README make .git

The .git entry shows you, that there's a repository in this directory. You can only issue a git command for the repo from this directory or any subdirectories.

fuz
  • 88,405
  • 25
  • 200
  • 352