INFO2180
INFO2180
COMMAND LINE/
TERMINAL BASICS
GIT
C:\Users\{username}> on Windows
or
yourusername@yourcomputername:~$ on
macOS/Linux.
GIT
PWD COMMAND
$ pwd
LS COMMAND
▸ Next let us try entering the ls command (on Windows you
can also try the dir command). This command will List the
contents of the current directory.
$ ls
CD COMMAND
▸ The third command we want to try is the cd command. This
command stands for Change Directory. So at the command line type:
$ cd
and if you know the name of the directory or path you want to go to
you can type:
$ cd {childFolderName}
e.g. $ cd Documents/
GIT
CD COMMAND
▸ You can also navigate up one directory from the one you are
currently in by using "../". For example:
$ cd ../
GIT
MKDIR COMMAND
$ mkdir some-folder
fi
fi
fi
GIT
RM COMMAND
$ rm index.html
fi
fi
fi
GIT
RMDIR COMMAND
$ rmdir some-folder/
$ rm -r some-folder/
fi
GIT
CP COMMAND
$ cp styles.css some-folder/
MV COMMAND
$ mv somefile.txt my-folder/
fi
fi
fi
There are many more commands, but those are
some of the most common and basic commands
everyone should know.
WHAT IS VERSION
CONTROL?
When you work on a project, how do you keep track
of different versions or changes in your les?
fi
some le.html
some le_v2.html
some le_not_working.html
some le_v10_ nal.html
some le_ nal_ nal.html
some le_ nally_got_it_working.html
styles.css
styles_test_something.css
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
Oh and what if someone accidentally
deletes the wrong version of a le? Or
all the les...
fi
fi
GIT
fi
fi
Source: https://www.atlassian.com/git/tutorials/what-is-version-control
GIT
▸ SVN - Subversion
▸ Mercurial
▸ etc...
GIT
WHAT IS GIT?
▸ Git is a free and open source version control system
fi
fi
GIT
WHAT IS GIT?
Source: https://guides.github.com/introduction/git-handbook/
fi
fi
INITIALIZING A
GIT REPOSITORY
To start a new local git repository
$ git init
* Note: You should navigate to the folder that contains your code before running this.
ADD
To create a Snapshot of your les in preparation for versioning
and tells Git that you want to include updates to a particular
le in the next commit.
$ git status
fi
COMMIT
This command records the changes in the repository along
with a message.
$ git log
To show metadata and content changes of the les in the
speci ed commit.
BRANCHES
▸ Develop features
▸ Fix bugs
Source: https://www.atlassian.com/git/tutorials/using-branches
To list all existing branches
$ git branch
To create a new branch
MERGE
fi
GITHUB
http://www.github.com
GIT
WHAT IS GITHUB?
▸ Github is a website and cloud based service.
▸ You can view your code online, view the commit history and see
the changes between versions of the les, view branches, etc.
fi
CLONING
To download a project from Github along with its entire version
history
$ git remote add <name> <url>
$ git remote
$ git remote rm <name>
$ git remote add origin https://github.com/john.git
PUSH
Uploads all local branch commits to GitHub
Note: The bookmark here could refer to a branch or a speci c commit hash.
fi
PULL
Downloads most recent changes from remote repository and
incorporates (or merges) those changes.
$ git pull
There are many other Git commands but these are a few of
the basics.
GIT
RESOURCES
▸ Installing Git - https://git-scm.com/book/en/v2/Getting-
Started-Installing-Git