-
Notifications
You must be signed in to change notification settings - Fork 0
Workflow with Git
Frank Siderio edited this page Mar 22, 2018
·
1 revision
TODO: Table of contents
Term | Meaning |
---|---|
Repository (Repo) | All the files of a git project (code tab on Github) |
Git | Command line tool that manages versions of a project's code |
Github | A website that allows users to put their git projects in the cloud (and access them easily) |
TODO: pictures/gifs
-
Download Git for your machine.
- NOTE: Please install the command line application, NOT the GUI (graphical user interface) version.
- Open the command line (Windows) or terminal (Mac)
- Type
cd
and then enter the path of the directory where you want to download the repository.-
cd
stands for "change directories." The terminal/command line acts as a text-based version of your file-system. - In order to download a repository to the correct place, you have to
cd
to the place where you want to download it.
-
- Enter
git status
.- If your command line says
Command "git" not recognized
or something along those lines, please try installing git again. - If your command line says
fatal: Not a git repository (or any of the parent directories): .git
please proceed!
- If your command line says
- Enter
git clone https://github.com/marist-sga/sga-website.git
- Your command line should produce a lot of download messages.
- Behind the scenes git is going to the url after
clone
(this repo), and downloading all those files into your current directory.
- After git is done downloading all the files, enter
-
Mac
ls
-
Windows
dirs
-
Mac
- You should see the top level folders for the website. Go to Windows Explorer on Windows or the Finder on Mac and check to see if those files are there (they should be).
- Open the project with your favorite text editor (Atom or Sumblime)
- Make changes to the files you want and save them.
- Go to the command line or terminal and
cd
to thesga-website
git repository folder on your machine. - Enter
git status
to view which branch you're on and which files need staging.- If it stays
On branch development
please switch to a different branch. - There should be a section of "Unstaged Files" (the files you changed).
- If it stays
- Type
git add
then file name of an unstaged files.-
git add
tells git "yes, please track these files for me" -
Tip: instead of typing
git add
filename, entergit add .
to add all unstaged files.
-
- Enter
git commit -m "Short descriptions of the updates I made"
- The
commit
command tells git "Yes, please save my progress at this point using the files I've staged" - The
-m
is called a flag. It's an optional addition to thecommit
command. It stands for message. It allows you to create a message to go along with your commit. - Please provide a message with every commit you make. It doesn't have to be long, just a quick update.
- The
- Enter
git push origin branchName
-
push
takes all your current commits and lets git know that you want to keep those changes. -
origin
is the default name of the repository that's on the cloud (Github in this case). git has two repositories: local and remote. The local repo is on your machine. The remote repo is the one you see on Github. -
branchName
Please put your branchName here. Please do not push tomaster
.
-
- Branches are used so developers can work separately on the same project and so the changes they make can be reviewed later in the pull request before they are merged into the base branch (development).
- Naming convention:
- The branch name should correlate to what you're working on. So if you had to create a page called James Bond your branch name would be
jamesBond
orjamesBondPage
. As long as the branch correlates to what you're working on that is fine.
- How to use branches:
- Enter
git branch your-branch-name
this creates a new branch. NOTE: It is case sensitive. - Enter
git checkout your-branch-name
this switches to the new branch. - To make sure you did it correctly enter
git branch
and if your branch is highlighted in green then you did it! Yay! - To just switch to a branch that is already created use
git checkout branch-you-want-to-switch-to
NOTE: You should not be making changes on the development branch (like ever) or else you will be mocked (and you don't want that).
- Home
- CIO
- Words of Wisdom
- Developers
- Designers
- Web Applications
- Making Changes
- Infrastructure
- Resources
- Key Contacts
- Future Plans