Skip to main content

setting up a repository

to create a new repository:

create a new directory, CD into it, run:

git init

or to clone an existing repository:

git clone <repository-url>

working with Git

git keeps track of files like this:

modified -> staged -> committed

changing a file -> modified

git add -> staged

git commit -> committed

adding files to a repository

adding files adds them to the staging area

see all your modified files with

git status

add files one at a time to carefully craft a commit

git add <file>

committing

when you are finished adding files to the staging area, commit:

git commit -m <commit-message>

make sure your commit message is descriptive

pushing your changes

your changes are now committed to your local repository

to push your changes to a remote repository

git push origin <branch-name>


I'm ready to branch