This is our version control system at CSG. We have many repos (repositories) that are publically accessible and therefore must be protected and well maintained. This is used to save all our work in a manner visible to our entire team. This is also a great way to show future employers the work you have done. One thing to always remember while using git is, do not work off of main.
As GitHub uses Git you will need to install that first. Go to the git downloads page and download and install the version that best suits your needs. Nothing else from here will need to be installed. You may use the mobile device to keep track of the repositories, but you will not be able to work on them from there.
NOTE: You will want to use a personal email and NOT your Cedarville email. This account is to be yours and therefore should be able to persist after graduation. It acts as a portfolio for your work. It is recommended that if you don't have a professional personal email, make one.
- Head to the GitHub registration page.
- Follow the steps there.
- You can access our organization from here.
- You will need to be added to the organization to make changes.
- It is not required but recommended that you set up 2FA on your GitHub. To do so, start by going to your profile security page. There are many options at the bottom of this page. Choose one or many.
Go into a terminal/shell and enter the following:
git config --global user.name "Your name here"
git config --global user.email "your_email@example.com"As long as you replace what is in quotations, you will have "logged in" to git. Keep in mind that your email should be the one used to create your GitHub account.
SSH offers better protection and authentication when working on repositories. It is not required for CSG, but is highly recommended.
- Open a terminal/shell and enter
cd .\.ssh\ - Enter
lsand look for two different files:id_rsaandid_rsa.pub. - If you have both skip to step 5, else continue to step 4.
- Create public/private keys by entering this command:
ssh-keygen -t rsa -C "your_email@example.com". Make sure to use the same email from the setup above. - Copy the contents of the
id_rsa.pubfile. With PowerShell usecat ~\.ssh\id_rsa.pub | clipor on Macpbcopy < ~/.ssh/id_rsa.pub. - You will now navigate to the GitHub profile settings.
- Click on
SSH and GPG keyson the left side. - Select
New SSH key. - Give the key a name linking you back to the device you are on, and then paste the contents into the
Keybox. - After saving, go back into the terminal and enter
ssh -T git@github.comto test that it worked. - You will likely get something along the lines of...
The authenticity of host 'github.com (140.82.112.3)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?- Enter
yes. - If you get something like
Hi username! You've successfully authenticated, but GitHub does not provide shell access.the setup was successful.
Default tracking enables your local installation of git to always point new branches to the origin. It removes the need to explicitly tell the branch.
- Open a terminal
- Check your git version with
git --version. You need to have version 2.37+- If you are not updated make sure to update git before continuing and refresh your terminal
- Run
git config --global --add --bool push.autoSetupRemote true
There are two different extensions that are recommended for installation for anyone using powershell to access git. These help speed up your own work and provide a bit of visual feedback to what is happening on the current branch.
- Open powershell and run
Add-Content $PROFILE.CurrentUserAllHosts "`nSet-PSReadlineKeyHandler -Chord Tab -Function MenuComplete" - Reset powershell; type
cdand press tab. If you get a few options under the current typed line then the setup was successful.
Follow the posh-git instructions. They have great documentation. If you can navigate to a git repo and see something resembling the following picture, then you were successful in setup. Don't worry about the green and red numbers right now, those are staged/upstaged changes. The current goal is just to see the branch name.
You will be able to access all of the repos by going to our organization page. Once inside a repository, there are a few things you will need to know how to do.
Cloning a repository is a necessary first step to work on any repository. It creates a local copy of the repository on your personal device which mirrors the repository found on GitHub. You can do this in a few ways: utilizing the desktop app (the instructions can be found on the linked page), or utilizing a terminal/shell. The steps for the latter are as follows:
- Open a terminal/shell and navigate to the folder you would like to contain the repo.
- Click on the
Codebutton as seen below.
- You will be able to choose from three options. We will look at
HTTPSandSSHhere. - If you set up
SSHin the installation phase then navigate there and copy the link. If not, copy theHTTPSlink. - Go back into your terminal and enter
git cloneand paste your copied link at the end. If you would like the repository folder to be named something other than what the actual repository is called then add it to the end. Here is an example usingHTTPSof our wiki repo, renamed to knowledge.git clone https://github.com/CreativeSolutionsGroup/wiki.git knowledge - You should now have a clone of the repository on your system.
Here is a compliation of all the commands used within a repository. They are in order, with the assumption you have not yet created a feature/, fix/ or update/ branch.
- Navigate to our project Kanban board.
- From here select one of the items in the
Todosection that you (or no one) have been assigned to. - Move the task into the
In Progresscolumn. - From here you can click
Open in new tabon the right side. - Now you want to create a new branch associated with your work by clicking on the link under
DevelopmentlabeledCreate a branch. - You will want to change the branch name.
- We use a few different prefaces for different reasons.
featureis our main preface that denotes the changes as mostly new items that add to the application.fixis for when you are working purely on fixing bugs.updateis uncommon, but for when you are just updating dependencies.
- After the preface add a
/. - Then describe what the task is in as few characters as possible.
- For example, I would consider the branch that I am working on creating this GitHub page,
feature/github-page.
- We use a few different prefaces for different reasons.
- You can then select
checkout locallyoropen branch with GitHub desktop, and clickCreate branch. - You are now good to switch branches.
- Get back to the main branch by running
git checkout main. - Run
git pull. This will get all of the changes from the remotemainon GitHub, updating your localmain. Every time an update is pushed to the repository'smainyou will need to rungit pullto see the updated status for any of your already-created branches. New branches will automatically pull the latest updates frommainwhen created.
If you did not create the branch in the previous section then you can do so in a few different ways. It is recommended that you still link the branch to whatever branch you are working on, however. First, you will want to update your local repo.
git checkout -b <BRANCH NAME>will create a new local branch and move you to it.git switch -c <BRANCH NAME>will also create a new local branch and move you to it. However, this command will also move any uncommitted changes as well.
Now that you have a new local branch and are moved to it, you will need to push the branch to the repo. git push --set-upstream origin <BRANCH NAME> will do this for you. You may also shorten it to git push -u origin <BRANCH NAME>
- Make sure there are no active changes on the branch you are currently on. This can be done by either removing, committing, or stashing the changes.
- Removing: To remove you have to do one of two commands:
- To reset the branch to the previous commit use
git reset --hard. Keep in mind that this will remove ALL of the changes. It is recommended that you first usegit statusto make sure that you desire none of the changes to be committed. - To remove specific files use
git restore <FILE>. This will restore any changes to the previous commit. Keep in mind that if there are any leftover changes you will still have to either commit or stash them.
- To reset the branch to the previous commit use
- Committing: You can find the steps for committing your changes further down the page or by clicking here.
- Stashing: By stashing you are saving all active changes but storing them for use later. You can stash by using
git stashand "unstash" by usinggit stash pop. You can pop the stash on any branch in the repo. Keep in mind that a faster way to move your changes to another branch is by using theswitchcommand found in step 2b.
- Removing: To remove you have to do one of two commands:
- You can now change the branch you are on. There are two ways to do that:
Checkout: This is an older way of changing branches. Usinggit checkout <BRANCH NAME>you will switch to an already existing branch as long as there are no uncommitted changes.Switch: This way is newer and works a bit faster. It includes a few perks, like moving any uncommitted changes without having to stash them. Usinggit switch <BRANCH NAME>you will switch to an existing branch carrying over any uncommitted changes. This avoids the need to stash, change branches, and then pop the stash.
When you have reached a milestone on the task or have finished up your work it is recommended you save all your changes to the repository. That is where committing comes into play.
- First, run
git statusto make sure that all of the changed files show up. - Run
git add .which will stage all of the changes to be committed. - Run
git commit -m "<COMMIT MESSAGE>"to commit your changes. The commit message should explain the changes you made in an easy-to-understand manner. It will allow for easy backtracking later, if necessary. - Run
git pushto push all commits to GitHub. If you get a warning that says that you do not have all remote changes rungit pulland thengit push.
At this point you are free to keep working, however, if this is the end of your task you have a few more steps to complete.
- Go back to our project board.
- Move the task you were working on from
In ProgresstoReady for Review. - Open the task in a new tab.
- Select the
Pull Requeststab at the top. - There should be a green bar that shows the branch you were on and an offer to make a pull request for it. Click that button and go to step 8. If there is not, then you will need to click the
New pull requestbutton. - Make sure the
basebranch ismain, and then change thecomparebranch to the branch you were working on. - Select
View pull request. - Go under the
reviewerssection and add your direct executive to review. - In the comments field add
Closes #<Task Number>.. The task number can be found on your task in the Kanban board. After that, add a description of the changes made on the branch. If testing requires extra steps, make sure to add those in the description also. - Submit the pull request. It is good practice to let your reviewer know the pull request is ready. You can do this by copying the link in your search bar and sending it to your reviewer through Microsoft Teams.
- Ensure all checks and tests were successful. If there were any failures, figure out why and leave a comment about it.
- Check files for quality. Your job is not to rewrite the code, but to make sure that what is there keeps with the Cedarville quality of code.
- If you see anything wrong select those lines and leave a comment specifying the problem.
- Once all issues are addressed, click the
Review Changesbutton at the top and leave an overall comment. SelectRequest Changesand thenSubmit Review. - If there were no issues, click the
Review Changesbutton at the top and leave an overall comment. Commonly we will sayLGTMmeaninglooks good to me. SelectApproveand thenSubmit Review. - If approved, head back to the conversation tab and select
Merge pull request.
Version 2.16.1(2)+: git update-git-for-windows
Version 2.14.2 to 2.16.1: git update
With Homebrew installed and git originally installed with Homebrew:
Run brew upgrade git.
With Homebrew installed but git not originally installed with Homebrew:
Run brew install git. This will override the previous install and automatically update git for you.
Without Homebrew installed:
Either install the new version directly from the git website, or install Homebrew with the following steps. The most recently updated version of git will automatically be installed with step 3.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"brew updatebrew install git
- Update system packages with
sudo apt-get update - Update git with
sudo apt-get install git


