Case Study 3 - Report On Git: Introduction To Github
Case Study 3 - Report On Git: Introduction To Github
● Introduction to GitHub.
Git is used to store the source code for a project and track the complete history of all
changes to that code. It allows developers to collaborate on a project more effectively by
providing tools for managing possibly conflicting changes from multiple developers.
GitHub allows developers to change, adapt and improve software from its public
repositories for free, but it charges for private repositories, offering various paid plans.
Each public or private repository contains all of a project's files, as well as each file's
revision history. Repositories can have multiple collaborators and can be either public or
private.
GitHub facilitates social coding by providing a web interface to the Git code repository
and management tools for collaboration. GitHub can be thought of as a serious social
networking site for software developers. Members can follow each other, rate each
other's work, receive updates for specific projects and communicate publicly or privately.
Three important terms used by developers in GitHub are fork, pull request and merge. A
fork, also known as a branch, is simply a repository that has been copied from one
member's account to another member's account. Forks and branches allow a developer
to make modifications without affecting the original code. If the developer would like to
share the modifications, she can send a pull request to the owner of the original
repository. If, after reviewing the modifications, the original owner would like to pull the
modifications into the repository, she can accept the modifications and merge them with
the original repository. Commits are, by default, all retained and interleaved onto the
master project, or can be combined into a simpler merge via commit squashing.
● Features of GitHub.
GitHub is a place where project managers and developers come together to coordinate, track,
and update their work so that projects are transparent and stay on schedule.
Packages can be published privately, within the team, or publicly to the open-source community.
The packages can be used or reused by downloading them from GitHub.
GitHub helps all the team members stay on the same page and organized. Moderation tools like
Issue and Pull Request Locking help the team to focus on the code.
Pull requests help the organizations to review, develop, and propose new code. Team members
can discuss any implementations and proposals through these before changing the source code.
GitHub uses dedicated tools to identify and analyze vulnerabilities to the code that other tools
tend to miss. Development teams everywhere work together to secure the software supply chain,
from start to finish.
All the code and documentation are in one place. There are millions of repositories on GitHub,
and each repository has its own tools to help you host and release code.
Now that we’ve gained some familiarity with GitHub let’s check out the competition.
● Introduction to Bitbucket.
Bitbucket owned by Atlassian web based version control repository management tool and now
days widely use in software industries. Almost all the software industries adopt the Bitbucket for
small to large scale software development.
Bitbucket written in Python using the Django web framework and for source code and
development use either Mercurial or Git revision control system. Bitbucket offer both commercial
plan and free account and with free account provide a facility to create unlimited private
repositories but with up to five user account only.
Bitbucket owned by Atlassian so you can easily integrates with other Atlassian software like Jira,
HipChat, Confluence, Bamboo, Slack and Jenkins.
Git provides various tools and applications to perform better handling of the work environment.
Git is a type of version control system that is used to allow more than one developer to access
the source code of a specific application and can modify changes to it which may be seen by
other developers.
Let’s suppose you are developing a project that is divided between various teams and will work
on different versions during and after development. For this kind of project, Bitbucket is the best
option for individuals or teams.
BitBucket is a git-based tool that helps on collaborations on large projects across various teams
and helps keep a track of different versions of a project that can access it from your local
machine.
It is specially designed for teams to collaborate on large projects in big enterprises. It is also
used for automated testing and deployment of code. Since this is a git-based tool, you need to
have git in your system to work with Bitbucket.
● Command-line statements like Push, Commit, etc.
git push
Pushing is the opposite of fetching (with a few caveats). It lets you move a local branch to
another repository, which serves as a convenient way to publish contributions. This is like svn
commit, but it sends a series of commits instead of a single changeset.
git commit
Takes the staged snapshot and commits it to the project history. Combined with git add, this
defines the basic workflow for all Git users.
git config
A convenient way to set configuration options for your Git installation. You’ll typically only need to
use this immediately after installing Git on a new development machine.
git pull
Pulling is the automated version of git fetch. It downloads a branch from a remote repository,
then immediately merges it into the current branch. This is the Git equivalent of svn update.
git reset
Undoes changes to files in the working directory. Resetting lets you clean up or completely
remove changes that have not been pushed to a public repository.
git status
Displays the state of the working directory and the staged snapshot. You’ll want to run this in
conjunction with git add and git commit to see exactly what’s being included in the next snapsho
● How to deal with Git, Bitbucket, and code editor (e.g., VSCODE) for beginners. (Show
Step by Step with images).
The first thing you need to do to take advantage of source control integration is initialize a project as a Git reposit
Visual Studio Code and access the built-in terminal. You can open this by using the keyboard shortcut CTRL + `
In your terminal, make a directory for a new project and change into that directory:
mkdir git_test
cd git_test
git init
Another way to accomplish this with Visual Studio Code is by opening up the Source Control tab (the icon looks li
ls -la
Output
..
.git
Now that the repo has been initialized, add a file called index.html.
After doing so, you’ll see in the Source Control panel that your new file shows up with the letter U beside it. U stan
untracked file, meaning a file that is new or changed, but has not yet been added to the repository:
You can now click the plus icon (+) by the index.html file listing to track the file by the repository.
Once added, the letter next to the file will change to an A. A represents a new file that has been added to the repos
To commit your changes, type a commit message into the input box at the top of the Source Control panel. Then,
You can use an Emmet shortcut to generate an HTML5 skeleton in VS Code by pressing the ! key followed by Tab
ahead and add something in the <body> like a <h1> heading and save it.
In the source control panel, you will see that your file has been changed. It will show the letter M next to it, which s
In this step you will take a look at what’s called the “Gutter” in VS Code. The gutter is the skinny area to the right o
number.
If you’ve used code folding before, the maximize and minimize icons are located in the gutter.
Let’s start by making a small change to your index.html file, such as a change to the content within the <h1> ta
doing so, you will notice a blue vertical mark in the gutter of the line that you changed. The vertical blue mark sign
Now, try deleting a line of code. You can delete one of the lines in the <body> section of your index.html file. N
now in the gutter that there is a red triangle. The red triangle signifies a line or group of lines that has been deleted
Lastly, at the bottom of your <body> section, add a new line of code and notice the green bar. The vertical green b
This example depicts gutter indicators for a modified line, a removed line, and a new line:
VS Code also has the ability to perform a diff on a file. Typically, you would have to download a separate diff tool t
this, so this built-in feature can help you work more efficiently.
To view a diff, open up the source control panel and double-click a changed file. In this case, double-click the
index.html file. You will be brought to a typical diff view with the current version of the file on the left and the pr
committed version of the file on the right.
This example shows that a line has been added in the current version:
Moving to the bottom bar, you have the ability to create and switch branches. If you take a look at the very bottom
the editor, you should see the source control icon (the one that looks like a split in the road) followed most likely b
To create a branch, click on that branch name. A menu should pop up giving you the ability to create a new branch
Go ahead and create a new branch called test.
Now, make a change to your index.html file that signifies you are in the new test branch, such as adding the t
Commit those changes to the test branch. Then, click the branch name in the bottom left again to switch back to
master branch.
After switching back to the master branch, you’ll notice that the this is the new test branch text comm
Through the Source Control panel, you do have access to work with remote repositories. If you’ve worked with a re
repository before you’ll notice familiar commands like pull, sync, publish, stash, etc.
Not only does VS Code come with lots of built-in functionality for Git, there are also several very popular extension
additional functionality.
Git Blame
● Conclusion
Git provides a way of keeping track of past versions of software and papers, making collaboration
between various authors easy, and provides backup for your software. It has proven very useful to the
open-source community and in academia as well..