0% found this document useful (0 votes)
39 views2 pages

CSE 102 Git Instructions

The document provides instructions for installing and using Git version control including initializing a repository, staging files, committing changes, and uploading the Git folder for assignments. Key steps are to initialize a Git repository for each assignment, commit changes regularly, and upload the hidden .git folder along with code files.

Uploaded by

Mert Dikbıyık
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

CSE 102 Git Instructions

The document provides instructions for installing and using Git version control including initializing a repository, staging files, committing changes, and uploading the Git folder for assignments. Key steps are to initialize a Git repository for each assignment, commit changes regularly, and upload the hidden .git folder along with code files.

Uploaded by

Mert Dikbıyık
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Hello everyone, from now on instead of screenshots you will upload the git repository folder of your

assignment. Here I will show you how you can install Git to your computer and how you can use it. This
will be a very basic introduction to Git. I will only talk about what you need to do for assignments. You
can find more information about how to install and use it online.

Some links:

Official documentation: https://git-scm.com/doc

W3Schools: https://www.w3schools.com/git/

Traversy Media @Youtube: https://www.youtube.com/watch?v=SWYqp7iY_Tc

Let’s start with what Git is. It is a version control system that helps you keep track of code changes. It is
created by legendary Linus Torvalds. Git has a GUI, but I would like you to learn using git through the
terminal. Git is different from GitHub. Latter one is a remote repository platform that allows
programmers to collaboratively work on code.

Git manages projects with Repositories. You can Clone a project to work on a local copy. Control and
track changes with Staging and Committing. Branch and Merge allow you to work on different parts and
versions of a project. Pull the latest version of the project to a local copy and Push local updates to the
main project. Here, I will not go into details, but I highly recommend you check out the links. The
purpose of this text is to mention important and very basic things you should do for each assignment.

Initializing Git on a folder, makes it a Repository. Git automatically creates a hidden folder to keep track
of changes in that folder. The hidden folder’s name is “.git” without quotations. When a file is changed,
added or deleted, it is considered as modified. You select the modified files you want to Stage, basically
they are getting prepared for Committing. Committing files prompts Git to store a permanent snapshot
of the files. You view the history of every commit through these snapshots. You can even revert back to
any previous commit. Git does not store a separate copy of every file in every commit but keeps track of
changes made in each commit.

You can download Git from its official website: https://git-scm.com/downloads

After installing the Git, you need to let Git know who you are. To do this you need to open a terminal and
type:

git config –global user.name “your name”

git config –global user.email “your email”

(there is double dash(-) before global)

For every assignment, you will go to source folder for your code(Where your java file(s) are) and either
through Command prompt(you can just click to part where it shows you the path information of the
folder and type cmd then press enter) or through Git Bash(you can just right click anywhere in the folder
and select Git Bash) open a terminal screen and you will type:

git init . (There is a space between dot(.) and init)


This will initialize the current directory as a repository. After you have finished writing a code for a unit of
work(for example writing a class) you can commit the changes. But before you can commit, you must
add the changes to the staging area, where they are getting prepared for the commit. To do this you will
type in the terminal:

git add .

Instead of dot(.) you can specify a file name. If you use the dot(.), Git will stage all files in the current
directory with changes, deletions or new entries for committing. To check which files are going to be
committed you type:

git status

This will show you what operations are made to each file. Don’t forget to add files to Staging because
otherwise you can’t commit these changes. It is always good to make your commits with a one-line,
short comment sentence that describes the commit. To commit the staged files you will type:

git commit -m “Written an Account class that represents a bank account”

Committing often but not excessively is the key of committing changes to your repository. You are not
required or limited for committing only when you have written a class. Instead, you usually commit when
you did a unit of work. Again, what a unit of work can change depending on a project and can vary from
one project to other.

DO NOT FORGET TO COMMIT YOUR CHANGES. It is important for us to see your assignments progress.
You will need to upload your Git repository along side of your java file. When uploading to turn in your
assignments. YOU NEED TO UPLOAD THAT GIT FOLDER TOO.

That “.git” folder may be hidden and you may not be able to see it inside of your folder. In that case, you
will need to make a quick google search to figure out how to show hidden folders.

In short, create a Git repository where your source code(java files will be). Commit the unit of works you
do throughout the assignment. Turn in your “.git” folder alongside of your java source file.

INITIALIZING A GIT REPOSITORY MUST BE THE FIRST THING YOU SHOULD DO WHEN YOU START
WORKING ON AN ASSIGNMENT. I also recommend you to commit not so long after initializing the
repository.

Lastly, don’t forget to check the links or other sources you find online to learn Git. It might be the most
important tool you will ever learn throughout your software career.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy