Lecture 43

git collaboration

MCS 275 Spring 2024
Emily Dumas

View as:   Presentation   ·   PDF-exportable  ·   Printable

Lecture 43: git collaboration

Reminders and announcements:

  • Project 4 due Friday
  • Don't forget your course evaluation
  • I will post on Blackboard about what comes next (e.g. course material archive)

Last time

We worked on a game with PyGame.

We cloned it from GitHub, made changes, committed, and pushed them.

Anyone can clone the repo and work locally. Only I can push to it, hence no true collaboration.

GitHub collaboration

We can mark other GitHub users as collaborators on a repo, allowing them to push to it.

(Private repos are invisible except to collaborators.)

Key consideration: Online repo can change with no action from us.

Revised workflow

  • git pull – get updates
  • git log – see what's changed
  • Make and test your changes
  • git add file1
  • git add file2
  • git commit
  • git push – make changes available to others

When can you push/pull?

The local and remote repos have a commit labeled HEAD, the "latest".

You can push only if the local HEAD derives from the remote HEAD.

You can always pull, but it may trigger a merge.

Failed push

If a   git push   fails, the solution is to:

  • git pull – starts a merge, often completes automatically
  • git push – to send the unified updates to the remote

References

Revision history

  • 2023-04-28 Finalization of the 2023 lecture this was based on
  • 2024-04-24 Initial publication
  • 2024-04-26 Fix title based on what we actually did