Getting Started with Git


Git is software that records changes to files over time. This concept is also known as version control. These recorded changes allow you to recall specific versions of the files at a later date.

Commands for your own project:

git init // create new repo

git status // show which files are changed and which of them are staged

git add -p // add “chunks” of changed files to the stage

git commit -m "<commit message>" // commit everything added to the stage with a commit message

git log // show a list of commits

git checkout <file> // throw away all changes since the last commit (one file)

git reset --hard // throw away all changes since the last commit (all files)

Commands for your someone else’s project:

git clone <repo_url> <target_dir> // clone a remote repository locally

git pull // download and merge new commits in the remote repo that happened since the last clone/pull

git push // uploading your own changes after a commit to the remote repo


Leave a Reply

Your email address will not be published. Required fields are marked *