GIT

Learning Git

So I went to a hackathon and had to work with branches. I realized I had forgotten the basics, so I’m writing them here for future reference.

Check current branch

git branch

Create and switch to a new branch

git checkout -b branchname

This creates a new branch locally and switches you to it. At this point, GitHub doesn’t know about this branch.

Add and commit changes

git add .
git commit -m "message"

Push branch to GitHub

git push -u origin branchname

The -u flag links your branch so next time you can just use git push.

Push future commits

git push

Comments