Monday, October 29, 2018

Basic git commands

So you are starting to research about code versioning and heard about git and github?

Below are some very few basic commands that I use to clone a github repository, create a new branch to develop a new feature or fix a bug, add and commit modifications to the branch and push it to github's repository.


# To clone a repository is the same as to download the files from a github repository to your local machine:
git clone <github-repository-address>


# Then you will create a new branch
git checkout -b <new-branch>


# after your development is ready, you add it to git and commit
git add .
git commit -m "<commit message>"


# after the commit is done, change to master and merge it
git checkout master
git merge <new-branch>


# after the merge is done, push it to the remote repository
git push origin master

No comments:

Post a Comment