Merging
Research[edit]
Introduction to Version Control (Emacs)
Experiment[edit]
Note: You will need to work with a partner for this lab. (We'll call the partners, Partner A and Partner B.)
First Steps[edit]
Only Partner A should perform the following steps:
Only Partner B should perform the following steps:
Both Partners[edit]
Both partners should now log on to the server.
Create a project directory:
cd ~/projects
mkdir project-1601
cd project-1601
Important: Do not skip this step! In order to successfully complete the remainder of the lab, it's important that your username and password (credentials) for GitHub are saved for future access. You can accomplish this by following the steps here and then continuing with this project.
Next, both partners should clone the newly created repository. Note that the actual name of the repository will depend on the user name of Partner A. Adjust the URL appropriately by replacing PARTNER_A_USER_NAME with the actual Partner A user name.
git clone https://github.com/PARTNER_A_USER_NAME/TheStory
Depending on your configuration, you may need to enter your username and password for GitHub. However, after this point, your credentials should be cached and you shouldn't need to enter them again and again.
Now, enter the directory and then pull the contents from the repository.
cd TheStory
git pull
Partner B[edit]
Partner B should now perform the following:
- Create a new file, "story.txt", with emacs:
emacs story.txt
Next, copy and paste the following text into the file. Then, save the file and exit.
Whilst we were talking, we heard a sort of sound between a yelp and a bark. It was far away; but the horses got very restless, and it took Johann all his time to quiet them. He was pale and said, "It sounds like a wolf - but yet there are no wolves here now." "No?" I said, questioning him. "Isn't it long since the wolves were so near the city?"
Check the status of your local git repository by typing:
git status
Question: After carefully reading the output text of the command, why do you think "story.txt" is listed as "untracked"?
In order to track the file, type:
git add story.txt
Helpful hint: If you need to add multiple files there's no need to issue the command multiple times. Just list the files one after another, separated by a space.
Check the status again:
git status
Question: After carefully reading the output text of the command, why do you think "story.txt" is listed as "new file"?
In order to commit your changes to your local repository, type:
git commit
Emacs will open enabling you to type a description of what you've changed (added, modified, deleted). This should be a useful message. For ideas about how to ensure that your message is useful, read The Art of the Commit (by David Demaree). After entering your message, save and exit emacs as usual.