Getting Acquainted with Github

“GitHub is more than just a programmer’s tool. If you want to
collaborate on anything, you should give it a try”

Today I learnt about many new commands in github which I was not aware
of. Lets begin by discussing all I knew and what I got to know about
Git.
Since Git was designed with a big project like Linux in mind, there
are a lot of Git commands. However, to use the basics of Git, you’ll
only need to know a few terms. They all begin the same way, with the
word “git.”

  • git status: Check the status of your repository. See which files are inside it, which changes still need to be committed, and which branch of the repository you’re currently working on.
  • git branch: Working with multiple collaborators and want to make changes on your own? This command will let you build a new branch, or timeline of commits, of changes and file additions that are completely your own. Your title goes after the command. If you wanted a new branch called “experiment,” you’d type git branch experiment.
  • git merge: There is nothing in git that makes this  the master branch special.  Unlike other revision control systems, git allows you to perform all actions on any branch.  So git allows any branch to be merged with any other branch.  When you’re done working on a branch, you can merge your changes back to the master branch, which is visible to all collaborators.
  • So to merge branches run the following:$ git checkout “label of destination”
    $ git merge “label of source”
  • git checkout: Literally allows you to “check out” a repository that you are not currently inside. This is a navigational command that lets you move to the repository you want to check. You can use this command as git checkout master to look at the master branch, or git checkout cats to look at another branch.
  • $ git checkout master: Return to the master branch.
  • git stash: Stashing is a great way to pause what you’re currently working on and come back to it later. For example, if you working on that awesome, brand new feature but someone just found a bug that you need to fix. Add your changes to the index using$ git add -A .Or add individual files to the index, your pick. Stash your changes away with:

    $ git stash

Renaming a git branch: In git, branching is cheap and easy. Renaming a branch is really easy:

$git branch -m old_branch new_branch

Advertisements