GitHub 101 Using Github and Git for Source Control

Slides:



Advertisements
Similar presentations
Version Control with git. Version Control Version control is a system that records changes to a file or set of files over time so that you can recall.
Advertisements

Introduction to Git and Github Joshua imtraum.com.
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Getting Started with GIT. Basic Navigation cd means change directory cd.. moves you up a level cd dir_name moves you to the folder named dir_name A dot.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
Version control Using Git Version control, using Git1.
Version Control. How do you share code? Discussion.
Version Control Systems academy.zariba.com 1. Lecture Content 1.What is Software Configuration Management? 2.Version Control Systems (VCS) 3.Basic Git.
…using Git/Tortoise Git
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Git Fundamentals Rochelle Terman 13 January 2014.
A Simple Introduction to Git: a distributed version-control system CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.5 © Mitchell Wand, This.
Intro to Git presented by Brian K. Vagnini Hosted by.
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
It’s not just an insult from Harry Potter!. What is Git? Distributed Version Control System (DVCS) – Compared to a Centralized Version Control System.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
Using Git with collaboration, code review, and code management for open source and private projects. & Using Terminal to create, and push commits to repositories.
Installing git In Linux: sudo apt-get install git In Windows: download it from run the setuphttp://git-scm.com/download/win.
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
GIT Version control. Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching.
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
Version Control Systems
Basics of GIT for developers and system administrators
CS5220 Advanced Topics in Web Programming Version Control with Git
Information Systems and Network Engineering Laboratory II
Discussion #11 11/21/16.
11 Version control (part 2)
CReSIS Git Tutorial.
Version Control.
Git Practice walkthrough.
GitHub workflow according to Google
Discussion 11 Final Project / Git.
Version Control overview
Version control, using Git
A Simple Introduction to Git: a distributed version-control system
CS5220 Advanced Topics in Web Programming Version Control with Git
ALICE-Juniors Meeting
Software Engineering for Data Scientists
Version Control with Git and GitHub
Macaualy2 Workshop Berkeley 2017
Version Control Systems
An introduction to version control systems with Git
Version Control with Git accelerated tutorial for busy academics
SU Development Forum Introduction to Git - Save your projects!
Distributed Version Control with git
Akshay Narayan git up to speed with RCS Akshay Narayan
An introduction to version control systems with Git
(Advanced) Web Application Development
The Big Picture
SIG: Open Week 1: GitHub Tim Choh.
dbatools! The reason to finally start learning and using Powershell
An introduction to version control systems with Git
Getting Started with Git and Bitbucket
dbatools! The reason to finally start learning and using Powershell
Using Github.
Git CS Fall 2018.
Version Control System - Git
Introduction to Git and GitHub
Git started with git: 2018 edition
GitHub and Git.
Version Control with Git and GitHub
Git Introduction.
Introduction to Git and Github
Git GitHub.
dbatools! The reason to finally start learning and using Powershell
Introduction to The Git Version Control System
Using GitHub for Papyrus Models Jessie Jewitt – OAM Technology Consulting/ ARM Inc. January 29th, 2018.
Presentation transcript:

GitHub 101 Using Github and Git for Source Control Patrick Flynn | Link Group Australia GitHub 101 Using Github and Git for Source Control

Thanks Sponsors Gold Silver Bronze

Patrick Flynn SQL Server DBA Link Group MCM – SQL Server 2008 MCSM – Data Platform Production DBA for 10+ years. https://github.com/sqllensman/Presentations sqlsaturday@sqllensman.com @sqllensman Patrick Flynn #761 | Perth 2018

Agenda: What is Git and GitHub? Why would you care? Basic Commands Demo

What is it? "Hello, Git! I hate you already!“ Most of us dislike Git on the first try even after running the most basic Git commands. Having a Git cheat sheet taped to our table doesn't help. Git is very complicated, as you can't learn all its concepts by just using it. To make Git our best friend, we should understand how Git works. To do so, we should also start using basic Git commands. What's Git? Git is a distributed version control system (DVCS). "Distributed" means that all developers within a team have a complete version of the project. A version control system is simply software that lets you effectively manage application versions. Thanks to Git, you'll be able to do the following: Keep track of all files in a project Record any changes to project files Restore previous versions of files Compare and analyze code Merge code from different computers and different team members.

It’s the worst source control system! (except for all the others).

branch checkout add commit pull push (plus a few more) It’s the worst source control system! (except for all the others).

Setup: Install Git Sign up for Online Account (Github) Install GitHub Desktop (optional) Can use

www. differencebetween www.differencebetween.net/technology/difference-between-git-and-github/

Workflow

BRANCH CHECKOUT ADD COMMIT

Fork

Make a fork of the dbatools repository Because you don't have write permissions to the repository, you'll have to fork it to your own repo, and do your commits there.

Clone Cloning a repository is very different from pulling from a repository. If you clone a remote repository, Git will: Download the entire project into a specified directory; and Create a remote repository called origin and point it to the URL you pass.

Clone a Repository git clone https://github.com/SQLLensman/dbatools.git Source: Michael Swart (http://michaeljswart.com/)

Configure Upstream remote git remote add upstream https://github.com/sqlcollaborative/dbatools.git Added automatically Most be added manually

Branch

Create a Branch git branch myBranch git checkout myBranch git push –u origin myBranch Source: Michael Swart (http://michaeljswart.com/)

Change Stuff

Make changes locally Example: Add new file Step 1: Make changes Source: Michael Swart (http://michaeljswart.com/)

Make changes locally Example: Add new file Step 1: Make changes Step 2: Stage changes git add * Source: Michael Swart (http://michaeljswart.com/)

Make changes locally Example: Add new file Step 1: Make changes Step 2: Stage changes Step 3: Commit changes git commit –m “commit message” One of the best pieces of advice that we've read was "you always have enough time to compose a meaningful commit message." It's true. Please make your summary meaningful. Not necessarily long, just meaningful. We tend to add a description probably once every 20 commits if we can't sum up the commit well in the summary. Source: Michael Swart (http://michaeljswart.com/)

Make changes locally Example: Add new file Step 1: Make changes Step 2: Stage changes Step 3: Commit changes Step 4: Push changes git push origin myBranch Source: Michael Swart (http://michaeljswart.com/)

Make changes locally Example: Add new file Step 1: Make changes Step 2: Stage changes Step 3: Commit changes Step 4: Push changes Step 5: Merge changes git checkout master git merge myBranch git remote add upstream [url to the original repo] git checkout [branch to be updated] git fetch --all git merge upstream/[branch to be updated] Source: Michael Swart (http://michaeljswart.com/)

Making changes Example: Add new file Step 1: Make changes git pull Step 2: Stage changes Step 3: Commit changes Step 4: Push changes Step 5: Merge changes Step 6: Pull changes git pull git checkout master When you run the "pull" command, Git will: Pull changes in the current branch made by other developers; and Synchronize your local repository with the remote repository. The "pull" command doesn't create a new directory with the project name. Git will only pull updates to make sure that your the local repository is up to date. git branch –d myBranch Source: Michael Swart (http://michaeljswart.com/)

Pull Request

PULL REQUEST Used to update original source Syncs FORKED repository with source Done via Github in Cloud

Demo’s of Backup Script Maintenance Plans Ola Hallengren Minion Backup

Further Info Arose from need to evaluate By Instance,

Other Useful Commands git status git remote –v git branch –d myBranch git checkout –b myBranch git remote update git fetch git stash Contrary to the above comments, git pull and git fetch are not completely different commands. Rather, doing a git pull on a given branch is the same as doing a git fetch followed by either merging or rebasing the current branch on its remote counterpart which was just updated. The utility of doing a git pull is that often the reason we fetch is to update a local branch with the version on the remote. So it is a bit of a convenience. We can always do fetch followed by merge separately. git fetch –all same as git remote update When you use pull, Git tries to automatically do your work for you. It is context sensitive, so Git will merge any pulled commits into the branch you are currently working in. pull automatically merges the commits without letting you review them first. If you don’t closely manage your branches, you may run into frequent conflicts. When you fetch, Git gathers any commits from the target branch that do not exist in your current branch and stores them in your local repository. However, it does not merge them with your current branch. This is particularly useful if you need to keep your repository up to date, but are working on something that might break if you update your files. To integrate the commits into your master branch, you use merge.

Free Online https://git-scm.com/book/en/v2

Cleanup Options if you want to reset changes or delete forked repository

Reset a Forked Repository # Check Remote Status git remote -v # Fetch Files git fetch upstream git status # Switch to main branch (if not already) git checkout development git reset --hard upstream/development git push origin development --force https://stackoverflow.com/questions/9646167/clean-up-a-fork-and-restart-it-from-the-upstream

Delete a Forked Repository in GitHub On GitHub, navigate to the main page of the repository. Under your repository name, click Settings. Under Danger Zone, click Delete this repository. Read the warnings. To verify that you're deleting the correct repository, type the name of the repository you want to delete. Click I understand the consequences, delete this repository.

Demo’s of Backup Script Maintenance Plans Ola Hallengren Minion Backup

Questions

Links https://git-scm.com http://www.eqqon.com/index.php/Collaborative_Github_Workflow https://zeroturnaround.com/rebellabs/git-commands-and-best-practices-cheat-sheet/ https://medium.freecodecamp.org/git-cheat-sheet-and-best-practices-c6ce5321f52 https://github.com/git-tips/tips https://blog.github.com/2015-06-08-how-to-undo-almost-anything-with-git/ https://rubygarage.org/blog/most-basic-git-commands-with-examples http://michaeljswart.com/2018/07/the-bare-minimum-you-need-to-know-to-work-with-git/ https://www.ibm.com/developerworks/library/d-learn-workings-git/ http://www.differencebetween.net/technology/difference-between-git-fetch-and-git-pull/ https://www.git-tower.com/learn/git/faq https://www.git-tower.com/learn/git/ebook/en/command-line/introduction https://www.git-tower.com/learn/git/ebook/en/desktop-gui/introduction https://www.pass.org/AttendanEvent/OnlineEvents/24HoursofPASS.aspx Lyndsey Padget Presentation on GIT VSCode https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens

Social Make sure you tweet on #SQLSat761 or #SQLSatPerth Don’t forget to thank Volunteers and other Speakers!

Thank you for attending #SQLSATPerth