Learning objectives

  • What is Github?
  • Connect Git with Github
  • Create a repository on Github
  • Connect local and push the changes on Github
  • Clone a repository

What is Github?

GitHub is a code hosting platform using the Git version control system. It lets you and others work together on projects from anywhere

Connect Git with Github

 We need to authenticate with GitHub using either HTTPS or SSH (Secure Shell Protocol). Since SSH is more secure, this is the recommended path.

  1. Generate an SSH key and add it to the ssh-agent
  2. Add your SSH key to your GitHub account
  3. Test your SSH connection

Create a repository on Github

Will be two ways to create a new repository:

Connect local and push the changes on Github

Clone a repository

git clone git@github.com:pazteddy/patrones_diseno_java.git

centralized

Is a Centralized Git Host

remote repo

github-test

Create a Remote Repo

remote repo

github-test

Add the Remote Repo to Local Git

github-test

git add remote origin remote-repo-url

remote repo

github-test

Synchronise changes

github-test

git push origin main

main

main

remote repo

github-test

Synchronise changes

github-test

git pull origin main

main

main

remote repo

c12

GitHub Flow

c12

main

main

c12

c12

main

main

1. Create a branch for your code

diegotc86

remote repo

github-test

GitHub Flow

github-test

main

main

github-test

github-test

main

main

2. Push your branch to the remote

diegot86

diegotc86

git push origin diegotc86

remote repo

github-test

GitHub Flow

github-test

main

main

github-test

github-test

main

main

3. Create a Pull Request

diegotc86

diegotc86

Pull Request

waiting for review

remote repo

github-test

GitHub Flow

github-test

main

main

github-test

github-test

main

main

4. The team make code review

If neccesary, change are requested

feature

feature

Pull Request

changes requested

remote repo

github-test

GitHub Flow

github-test

main

main

github-test

github-test

main

main

5. The author push new changes

feature

feature

Pull Request

waiting for review

remote repo

github-test

GitHub Flow

github-test

main

main

github-test

github-test

main

main

6. The team make code review again

If it looks good, they approve the PR

feature

feature

Pull Request

code approved

remote repo

github-test

GitHub Flow

github-test

main

main

github-test

github-test

main

main

7. Everyone pull updated main

git pull origin main

git pull origin main

git pull origin main

remote repo

github-test

GitHub Flow

github-test

main

main

github-test

github-test

main

main

All clean, all good

Made with Slides.com