GIT [ ‘VCS’ through which Testers can Depict the BUG and Dev can Fix the BUG! ] GITHUB [Code-Hosting platform with lots of integrated features].

Accessing GITHUB with GIT terminal ^_^

Thinking about How to Add Files to Github Repo? Want to know how to collaborate with Team? Want to add Awesome intro for your profile? Oh! you are Developer and looking to Track files? …

GIT [ Version Control System]:

Suppose you have file/folders and you want to make all the changes that you want to do with that file/folders can be done using VCS. Along with that it will track all the changes and maintain Version history as well. Another Major benefit with git is you can collaborate with team.

GIT Version Storage Management

Centralized Version control:

People from multiple work stations can commit or update files on single repository which is on server. If anything goes wrong on that repo then it’s highly typical to backup those files as there’s only single copy in server along with that people who are connected to that repo need to be online continuously.


Distributed Version Control System:

Every individual in different work stations who are working on same repository in server are able to create local repository. Here if anything goes wrong on Repo exists in server we can backup that repo with local Repo. Other benefit is no need to be connected for long individual can work on local repo’s once it’s done you can push the files in main Repo.

Distributed Version control

So what I want to say is….

GIT is Free and Open Source DVCS [Distributed Control System].



Code-hosting platform where Developers can host their websites for free. Mostly it provides Visual User Interface for your Repo along with that it will make collaborations Easier. Place where you can emerge with technologies with incredible Github features in your finger tips.

click on new Repository

GITHUB SIGNUP > +[top right corner] > Update( Repository name, include Readme file)>Create Repository


Game begins now!!

Introduce yourself to Git by giving following command!

if you are able to see the version you installed then your git is installed successfully if not you find any Error like “Command Not found” indicate your git is not installed or not compatible.

Now Add your Username and Email to Git by following commands

Note: Username need not to be GITHUB username just give the name with which name you want to made changes everytime or for every repo and email need to be email you have used for GITHUB.

Adding Files/Folders to GIT:

Initially change Directory in terminal by following command in place of FolderPath copy path of folder you want to add/push into repo and paste it there.

Initialising Git: empty git Repo will be initialised in that local folder. once it’s initialised .git hidden folder will be created.

Viewing Hidden files in MAC:

$ defaults write AppleShowAllFiles YES

closing Hidden Files in MAC:

$ defaults write AppleShowAllFiles NO

Status: View the status of git. Number of files added/Modified.

Now lets add files in 2 different ways 1st command to add files One by One and 2nd command is to add all at a time.

to add all of your files to the staging area. You can commit these changes with the command.

Now signin to GITHUB and Create Repository

GITHUB SIGNUP > +[top right corner] > Update( Repository name, include Readme file)>Create Repository

Once it’s done GOTO Repo from dashboard and click on code then copy path to that Repo.

You can view path in Clone dialogue box

Now you know how to create Github Repository and how to add files to it!


Initially clone that Repo you want to work in your local Repo.

Click on Download Zip

Use following commands to collaborate with team

if you want to add new feature to master branch then use following command

save that source code you are working on now add files

Now push all the files to master branch

Now to Github and check the Repo you can see Compare & pull request button click on that it will redirect to create pull request page just click on that create PR button after adding proper description.

if you have PR then after performing proper code review you can Merge Pull Request which changes your source code.

No conflicts just click on Merge PR

Or use following commands to merge

In order to create an upstream branch so that you can push your changes and set the remote branch as upstream, you will push your feature by running

Great! Now you viewed commands for GITHUB Team collaboration!! ^_^

Hosting Webpages on GITHUB:

GITHUB> Create new Repo> Open cmd

$ git init

$ git status

$ git add .

$ git commit -m “commit message” .

$ git remote add origin “<Path_of_repository>”

$ git push -u origin master

//Provide login credentials and goto github repo you created

Settings>Github pages>Source[Master]>save

select main

then right click on the link displayed and open in new tab. There you go you have hosted your webpage.

GIT Cheat sheet:

Git Basics

Create empty Git repo in specified directory. Run with no arguments to initialize the current directory as a git repository.

Clone repo located at <repo> onto local machine. Original repo can be located on the local filesystem or on a remote machine via HTTP or SSH.

Define author name to be used for all commits in current repo. Devs commonly use — global flag to set config options for current user.

Stage all changes in <directory> for the next commit. Replace <directory> with a <file> to change a specific file.

Commit the staged snapshot, but instead of launching a text editor, use <message> as the commit message.

List which files are staged, unstaged, and untracked.

Display the entire commit history using the default format. For customization see additional options.

Show unstaged changes between your index and working directory.

Undoing Changes

Create new commit that undoes all of the changes made in

<commit>, then apply it to the current branch.

Remove <file> from the staging area, but leave the working directory unchanged. This unstages a file without overwriting any changes.

Shows which files would be removed from working directory. Use the -f flag in place of the -n flag to execute the clean.

Rewriting Git History

Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message.

Rebase the current branch onto <base>. <base> can be a commit ID, a branch name, a tag, or a relative reference to HEAD.

Show a log of changes to the local repository’s HEAD. Add

— — relative-date flag to show date info or — — all to show all refs.

Git Branches

List all of the branches in your repo. Add a <branch> argument to create a new branch with the name <branch>.

Create and check out a new branch named <branch>. Drop the -b

flag to checkout an existing branch. Merge <branch> into the current branch.

Remote Repositories

Create a new connection to a remote repo. After adding a remote, you can use <name> as a shortcut for <url> in other commands.

Fetches a specific <branch>, from the repo. Leave off <branch> to fetch all remote refs.

Fetch the specified remote’s copy of current branch and immediately merge it into the local copy.

Push the branch to <remote>, along with necessary commits and objects. Creates named branch in the remote repo if it doesn’t exist.

Define the author name to be used for all commits by the current user.

Define the author email to be used for all commits by the current user.

Create shortcut for a Git command. E.g. alias.glog log — — graph

— — oneline will set git glog equivalent to git log — — graph — oneline.

Set text editor used by commands for all users on the machine. <editor>

arg should be the command that launches the desired editor (e.g., vi). Open the global configuration file in a text editor for manual editing.

Limit number of commits by <limit>. E.g. git log -5 will limit to 5 commits.

Condense each commit to a single line. Display the full diff of each commit.

Include which files were altered and the relative number of lines that were added or deleted from each of them.

Search for commits by a particular author.

Search for commits with a commit message that matches <pattern>.

Show commits that occur between <since> and <until>. Args can be a commit ID, branch name, HEAD, or any other kind of revision reference.

Only display commits that have the specified file.

— — graph flag draws a text based graph of commits on left side of commit msgs. — — decorate adds names of branches or tags of commits shown.

Show difference between working directory and last commit.

Show difference between staged changes and last commit

Git Reset

Reset staging area to match most recent commit, but leave the working directory unchanged.

Reset staging area and working directory to match most recent commit and overwrites all changes in the working directory.

Move the current branch tip backward to <commit>, reset the staging area to match, but leave the working directory alone.

Same as previous, but resets both the staging area & working directory to match. Deletes uncommitted changes, and all commits after <commit>.

git rebase

Interactively rebase current branch onto <base>. Launches editor to enter commands for how each commit will be transferred to the new base.

Fetch the remote’s copy of current branch and rebases it into the local copy. Uses git rebase instead of merge to integrate the branches.

Forces the git push even if it results in a non-fast-forward merge. Do not use the — — force flag unless you’re absolutely sure you know what you’re doing.

Push all of your local branches to the specified remote.

Tags aren’t automatically pushed when you push a branch or use the

— — all flag. The — — tags flag sends all of your local tags to the remote repo.

Integrating GITHUB with Eclipse:

Initially copy URL of the Repo from Github in which you want to add files.

Right click on Package explorer left panel then click on import.

click on import

if you can’t find Git plugin then you need to install it. if it’s there select Projects from Git.

select projects from Git

if you already have project in existing repo then choose clone Repository if not choose local Repository then click on next.

select clone Repository

Now paste Project URL in URL input box and enter user github credentials and click on next.

provide valid user credentials!

Check the Master/Main branch and click on next.

Check the Repo you created is empty or not if not just rename it and click on next.

Once it’s cloned choose import existing eclipse projects and click on next.

Once it’s imported you can view your project on eclipse left panel. After performing changes in source if you want to update it in Master Branch of Github.

Right click on left panel >Team>Push BRanch ‘main’…

Now click on Preview.

Click on Push!

//If Repo already exists and just want to update changes then you can right click on project> Team>pull

While doing commit update commit message as well!

I would be more than happy if you send your feedback, suggestions or ask queries. Moreover, I love to connect people who are really passionate about building real time products!!

If you have any suggestions or queries contact me:



IBMer || Lazy Programmer | Artificial Intelligence Enthusiast | Tech Blogger | Sketcher ||