-
Notifications
You must be signed in to change notification settings - Fork 0
/
06_04_collaborating.txt
executable file
·49 lines (41 loc) · 1.42 KB
/
06_04_collaborating.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#======================================================================================
# EPISODE - COLLABORATING WITH A REMOTE REPOSITORY
# SECTION - CONFLICTS AND HOW TO RESOLVE THEM
#======================================================================================
# Our push fails, as we’ve not yet pulled down our changes from our
# remote repository.Before pushing we should always pull, so let’s do that…
#
git pull origin master
git status
#
# We can see that our file is listed as Unmerged.
# If we look at paper.md, we see something like:
tail -n 10 paper.md
# The mark-up shows us the parts of the file causing the conflict and the versions
# they come from.
#
# We edit the file. Then commit our changes.
#
# ** File Edits **
# Change authorship section to:
#
# Author
# John Smith, University of Elsewhere
# Kamilla Kopec-Harding, University of Manchester
#
git add paper.md # Stage the file
git commit # Commit to mark the conflict as resolved
# Now, if we push, all goes well.
#
git push origin master
#
# If we now go to GitHub and click on the “INSIGHTS:NETWORK” tab we can see
# where our repository diverged and came together again.
#
# We’ll finish by pulling these changes into the other copy of the repo (desktop, paper), so
# both copies are up to date:
#
cd ../paper # Switch to 'paper' directory
git pull origin master # Merge remote branch into local
# Success!
# - End -