-
Notifications
You must be signed in to change notification settings - Fork 2
Intro to git lab training (topic branch workflow)
Welcome to the intro to git training lab! We will start by getting everyone into the WWU-ACM Github organization
and breaking up into teams. Your team will use on the repositories name in the following fashion WWU-ACM/fa14-team#
.
This tutorial is the followup from my lecture slides
If you are in Cygwin on Windows or the terminal in Mac OS then ssh <cs username>@linux.cs.wwu.edu
and Linux with us.
-
Since we are using Github as our repo host you will need an account. Make one here if you don't have one already.
-
There will be team lists on the board - go add your Github account name to a team list (3-4 to a team).
-
You will be added to the WWU-ACM organization and placed in the Intro to Git Lab Team. This team is a Github construct and organization team members have access to repos also added to the team. (The teams on the board correspond to which repo you will be working with)
-
Set up your git config.
git config --global user.name "Your Name" git config --global user.email "you@example.com"
-
Generate an ssh key.
ssh-keygen # use all defaults (enter enter enter...) cat ~/.ssh/id_rsa.pub # copy the output of this
Go to your GitHub ssh key page and add a new key. Use the output of the cat command as your key.
After that you should be able to verify your key setup with the following command.
raderk@linux-10:~$ ssh git@github.com PTY allocation request failed on channel 0 Hi kyle-rader! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.
Your team's main repo already exists in the WWU-ACM org.
-
Fork your team's repo on Github.
-
Clone your forked repo
git clone git@github.com:your-username/fa14-team#
Replace your-username with your Github account name and # with your team number.
-
Change the current directory to your repo.
cd fa14-team#
-
Add the
upstream
remote.git remote add upstream git@github.com:WWU-ACM/fa14-team#
-
Create a branch called add-name.
git checkout -b add-name
-
Create this branch on Github.
git push -u origin add-name
-
You are now going to add your name to the Names list in the
README.md
file. -
After adding your name
git status
will show you have un-staged changes. Let's add them interactively withgit add -p
-
Now
git status
will show changes are staged. Let's commit them withgit commit -m "Added to the names list." git push origin add-name
-
Now on Github you can make a pull request from the branch add-name on your repo to the dev branch of the WWU-ACM's fa14-team# repo.
-
After this pull request is finished each team member must now update their repo's dev branch.
git checkout dev git pull upstream dev git push origin dev
Now we need to
rebase
the branch add-name.git checkout add-name git rebase dev // This will cause a merge conflict if you pulled someone else's change. //You now have to fix the merge conflict
If you were the first to get your pull request in then you don't actually need the branch anymore.
If you are fixing a merge conflict then upon fixing said merge conflict you can submit a pull request or if
you already have a pull request open it will automatically update with your fix.