Week 3̷4- Office Hours
Part 1 - Rebasing
git log --graph --oneline
Open the terminal in the folder with the repository you used for the homework.
Run
gh browse
and add a line toweek-3.txt
, commit changes.Add a line to "week-3.txt" locally, stage, commit.
git push
. What is the problem?Download data from GitHub without pulling.
What was the alternative to
git merge
in the homework? Do that.Resolve the conflict in the editor.
Tell what
git status
suggests and then what the error message suggests in order to finish the rebase, then push to GitHub.git log --graph --oneline
How do the two conflict situations differ?
Part 2

This week, we'll discuss the meaning of the following terms:
Commit.
Staging (aka Adding).
Committing.
Folder Tree, Repository Root.
Working Tree.
Staging Area (aka Index).
HEAD.
Repository (aka Repo).
Git command anatomy
We'll talk about what individual pieces of a git command represent.
Undoing in git
One of the points of version-controlling code and text is to be able to undo mistakes. We'll see different versions of how this can be done.
Prepare files and folders
Go to this link, download the files as an archive (click Code
-> Download Zip
), unzip it into the folder where you keep everything related to this course.
If you only have a single folder with one of the repos you created earlier then create a new folder, and put both the repo folder and the folder with the unzipped files. Here is what the folder structure should look like:
git-course/
├── my-repo-1/
│ └── ...
├── my-repo-2/
│ └── ...
└── week-4-files/
└── ...
The names of the folders and the exact structure isn't important. The main thing to avoid is this:
my-repo-1
week-3-files
...
...
Follow along
The commands below should be run one at a time even if they are printed in one code block.
Folder tree, root
Go to the git-course
folder and run tree .
in the Terminal.
Repository root
mkdir week-3-repo
cd week-3-repo
git init
ls
ls -a
git status
Commits, staging, head
<copy week-3-files/README.md>
git status
git add -- README.md
git status
git commit -m "add README.md"
git status
<copy week-3-files/01_data/ to .>
git add . # don't do it! at least not without git status first
git status
git rm --staged . # that's the opposite of git add for new files
git add . -v # better but should still be avoided
rm 01_data/02_derivatives/analyzed_data.csv
git rm --staged -- 01_data/02_derivatives/analyzed_data.csv
git commit -m "add raw data"
Last updated