2. What is Github?
● Popular version control tool
● Used for personal projects, club projects, enterprise level codebases
● Plenty of alternatives used in the industry such as Bitbucket, Gitlab
● Brings together a community with tons of resources
3. What is Github Desktop?
● Github, but on desktop!
● Differs to tools such as
gitbash and Command
Line Interface
4. Why Github Desktop?
● Compatible with
macOS, Windows,
Linux
● Works very fast on
terminals
● Very user-friendly
● Easy to collaborate
10. Creating Your First Repository
Name of repository
Description of repository
Location of the repository
on your computer
Ignore certain files in
the repository
A README is a file that
describes the repository
License
11. git clone
● Used to create a copy of an online repository to the local machine
● Github Desktop offers a very quick and easy way to clone repositories, without the use of
explicitly typing “ git push <repo link> ”
Importing a repository to local Machine
12. ● In Github Desktop, cloning a repository you don’t own will
fork the repository
Forking a Repository
15. ● You’ll be able to find the local version of the repository on your computer
● If we want to change everyone’s code, we create a change on this local version and then:
1. Add the changed files
2. Commit the change (basically ‘saving’ a change)
3. Push the changes
Changing Code
16. 1. Add the changed files
● Typically, we would add the modified files
when we want to push a change
● Stage or prepare for a commit
● However, Github Desktop automatically finds
modified files!
17. 2. Commit your changes
● Committing a change essentially ‘saves’
your changes without uploading it to the
project
● Add a commit message to keep track of
what changes were made
18. 3. Push your changes
● Upload your commits to the project
● Others editing the project can only view
your changes after this stage
19. Pulling changes
● Oftentimes, when more than 1 person is working on their project, one person makes
their changes and pushes their code to a Branch
Synchronizing Project Progress Locally
Changes shown on Github
Need to synchronize locally
20. Fetching changes
● git fetch tells a user if its local repository is different to the remote repository
[notification-like]
Synchronizing Project Progress Locally
Local Repository is
synced with remote
repository
Local Repository is
not synced with
remote repository
21. Git Branching
What is a Git Branch?
● It is a portion (branch) of your project
(tree) that has all of the content of the
main project (master)
● Changes to the branch will not affect the
rest of the project until you want to
● You can merge your new branch with any
branch by going to
Branch > Merge into current branch
● If you are working with others, you may
cause conflicts so be careful
22. Creating and Using a Git Branch
● Create a new branch by clicking on the branch dropdown menu and clicking
New Branch
● The branch you are on is displayed under Current Branch
● Commit your change by pressing Commit to <branch-name>
Example:
23. ● On Github Desktop, just select the desired branch
● On Git Bash, you’d use the checkout command
Moving Between Branches
24. Merge conflicts occur when Git is unable to auto merge multiple independent
edits to a file. Merge conflicts get labelled in files and many text editors support
highlighting them for ease of use.
Example:
Merge Conflicts
Editing the same line in a file in two separate commits and attempts to
merge them causes merge conflicts
25. To resolve merge conflicts on Github Desktop, look at both versions of the conflict
and think about why they are different and which one is correct. When we
determine that, we just need to delete the incorrect statement and merge once
again.
Example:
Resolving Merge Conflicts
Two import statements that are conflicting,
import java.util.Scanner; is correct
Incorrect import
statement is deleted
26. Git Revert
● Reverting changes is similar to using
undo with Ctrl + Z
● Rather than removing the commit from
the project’s history, it inverts the
changes caused by the commit
● It also appends a new commit with the
resulting inverse content
● This way, Git doesn’t lose any history
and we still have access to revision
history and can collaborate reliably
Example use:
Instead of finding a bug and fixing it, by
clicking Revert changes to commit Github
will find it and automatically fix it for you
27. ● Free perks for student github accounts and leverage paid tools
● Link: https://education.github.com/pack
Github Student Developer Pack