How do I create a new branch based on an existing Git hub branch? (Please read - tried the beginners guide)
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 开发者_StackOverflowdon'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
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.
精彩评论