Git Product home page Git Product logo

cursogit2016-2017's Introduction

Taller de GIT

Curso de Git - 2016 2017

https://acmfi.github.io/cursogit2016-2016

Introdución

Control de versiones

./img/delta.png

./img/snapshots.png

Control de versiones local, único ordenador.

./img/local.png

Control de versión centralizado.

./img/centralized.png

Control de versión distribuido.

./img/distributed.png

./img/git-logo.png

  • Control de versiones
  • Potencia el desarrollo de código distribuido.
  • Y mola mucho

Instalar GIT

sudo pacman -S git #Arch based

sudo apt-get install git #Debian based

brew install git #macOS

Configurar GIT

git config --global user.name "Your Name"

git config --global user.email "[email protected]"

git init

git remote add {nombreDelRemoto} {URLDelRepositorio}

git clone

Git vs Otros entornos. ¿Por qué git?

  • Porque sí. ¿Esperabas una respuesta mejor? Pues no.
  • Es lo que toca porque lo vamos a usar en las asignaturas.
  • También es la herramienta más extendida y a la que todas migran.

SVN

  • Pros:
    • Sencillez.
  • Contras:
    • Solo existe un repo, imposible trabajar en local.
    • No es git.
    • Sencillez.

Mercurial

Bitbucket.

  • Pros:
    • Simple pero casi igual de potente que git.
    • Newbie friendly.
  • Contras:
    • ¿Trabajar con ramas?. Iluso…
    • Monolítico.
    • Menos flexible.

Estructura de Git

./img/git-parts-repo.png

./img/git-flow.png

Comandos de git. Desde lo más útiles a los salvavidas

Git Status

git status

./img/git-status.gif

Add & Commit

./img/file-status-livecycle.png

git add [files]

git add . #Añadiría todos los cambios al index

git add *.java #Añadiría únicamente aquellos archivos modificados que terminen en .java

git add directorio/ #Añadiría el directorio y TODO SU CONTENIDO al index
git commit [--ammend] [-m "Mensaje del commit"]

git commit -m "Hello World Completado"

git commit -a -m <mensaje> # Equivalente a git add --all y git commit -m "Mensaje"

Push

git push [<remote>] [<branch>]

git push #Equivalente a git push <remote>, solo si existe el remoto

git push <remote> master # push de los cambios a la rama master del remoto

Log

git log

./img/git-log-bad.jpg

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

./img/git-log-good.jpg

Pull

git pull

git pull origin # git fetch && git merge FETCH_HEAD

Branch

git branch [opts] <nombre_de_la_rama> #Para listar, crear o eliminar ramas

./img/git-flow.png

Checkout

git checkout <nombre_de_la_rama>

Merge & Rebase

git merge [branch] # Mergea branch con la actual

       A---B---C topic
      /         \
 D---E---F---G---H master
   kbranch      merge

git merge [-m "Mensaje del commit"] [branch] # Mergra branch con la actual y lo incluye en un commit

git merge [--abort] # Aborta el merge si entran en conflicto

git rebase [branch] # Rebase. Por cada commit que hay en el branch, rebase genera un nuevo commit en el branch actual

      +--3--5   master
      |
1--2--+
      |
      +--3--5--7--8   feature
              (4)(6)
    branch    rebase

Conflictos

Lo que no ha unido la máquina, que lo haga el desarrollador.

./img/conflict.png

./img/conflictSolved.png

Stash

git stash

Usado para descartar cambios y volver al estado anterior del commit.

Rebase, Fetch, Pull Request

¿Preguntas?

Buenas praxis de git

  • No te asustes.
  • Las ramas son tus amigas.
  • Commitea a menudo con cambios graduales y específicos.
  • Ponle un mensaje útil a los mensajes.
  • No todos los aportes son iguales: Las ramas son tus amigas.
  • gitignore
  • NO HAY UNA ÚNICA FORMA DE HACER ALGO CON GIT

./img/git-flow.png

Integración con otras herramientas/entornos

Magit

./img/Emacs-icon.png

./img/git_kraken.png

www.gitkraken.com

./img/SourceTreeLogo.png

www.sourcetreeapp.com

Eclipse (sí…)

./img/EclipseLogo.png

www.eclipse.org/egit

Y más

  • Matlab, Visual Studio…

Platafromas (host)

./img/chart-comparision.png

Github

./img/github-integration.png

Github Education

  • Repositorios privados ilimitados durante 2 años

education.github.com

Recursos

¿Preguntas?

cursogit2016-2017's People

Contributors

ignaciobll avatar cazaril avatar

Stargazers

 avatar Daniel Melero Chaves avatar Sergio Valverde avatar

Watchers

Alvaro Vila avatar James Cloos avatar Rock Neurotiko avatar Ashida avatar  avatar coyote3007 avatar  avatar

cursogit2016-2017's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.