Git-Hub Commands that are useful for beginners who want to contribute to the Open Source!!!

tejaswini22199 profile image tejaswini22199 Updated on ・2 min read

Before going to that let us understand what is Git-hub. What is the difference between Git and Git-Hub, GIT is version control system which is used to track changes in the files where as Github is a software which enables you to manage your git repositories.


When you want to store a folder that is present in your local computer to the git hub which is cloud based software you need to initialize a git repository first.

  • git init: This Command is used to initialize repository in your local folder but it is invisible (stored as .git file) If you want to contribute to any other repository, you should first fork that repository into your account. For that, you can directly click the fork symbol using the UI of Git-hub.
  • git clone: To download your repository in your local machine. You need to have a branch for each of the issue that you are solving so you need to create a branch. Go to the file location using command prompt or git-bash.
  • git branch : It displays all branches of that repository.
  • git branch newb : Creates new branch names newb
  • git checkout newb : Used to switch branch to newb So now you can start modifying that repository in your local machine. After you modify to check the status
  • git status: Used to check the untracked files or un committed files Every time to you need to keep your local repository updated from where you forked because many developers will be working on same repository so you need to get updates that are merged to the repository. To do that
  • git remote add upstream link of source repo: which will add the repository from where you cloned as remote(remote is repo in which you want to contribute).
  • git add . : It is used to add the files to the state which we want to track the changes
  • git commit -m "Add a meaningful message which describes your changes" : It is used to add the changes to your local repository
  • git push origin branch name : It is used to push your files into local repository. Now you can create pull request by going to your repository in git Hub and the maintainers will be able to merge your branch if it doesn't have any conflicts.
  • git branch -d branch name : To delete a branch

Posted on by:


Editor guide