Git

GDG Cusco - Segundo Meetup - 07/09/2022

Angel Hañari

Drupal Developer

drupal.org/u/langelhc

Goal

- Learn how to use Git from the Terminal.

Requirements

$ cd myproject
$ ls -la
# PRESENTING CODE

Basic command for the Terminal

# PRESENTING CODE

Git was created by Linus Torvalds in 2005

Why GIT?

# PRESENTING CODE

What is GIT ?

# PRESENTING CODE

is a free and open source Software

What is GitHub?

# PRESENTING CODE

is a Web site where you can host/share your Repositories.

Alternatives to GitHub

# PRESENTING CODE

*Open source and Self-managed

How to use Git?

# PRESENTING CODE

GUI

Ex: SourceTree

https://git-scm.com/downloads/guis/

Terminal

How to install Git?

# PRESENTING CODE

https://git-scm.com/downloads

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
$ git config --global core.editor nano
# PRESENTING CODE

Git: Initial config

# PRESENTING CODE

How it works?

Git: Basic Commands

# PRESENTING CODE
# My first commit
$ git init
$ git add .
$ git commit -m "Initial commit."

#additional commands:
$ git status
$ git diff
$ git add -p
$ git log
$ git log –oneline
# Push changes to remote repo.
$ git push

.gitignore

# PRESENTING CODE
vendor/
*.sql
# Ignore .env files as they are personal
/.env

is a plain text file where each line contains a pattern for files/directories to ignore

DEMO

GitHub

# PRESENTING CODE

- Create/Add Public SSH Key.

- Create a Repository

- Associate local repo to GitHub.

# PRESENTING CODE

Bonus:

# PRESENTING CODE

- Git branches 

- Git Stash

- Git Blame

Thank you

Q&A

Code

By Angel Hañari

Code

  • 125