Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

alebausa/git-collaborative

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Working in pairs with Git 👯

This repo is for students to practise committing, creating branches and merging them, and working in pairs with Git to get ready for the project

🎬 Practise time!

Iteration 1: me, myself and I

  • Miembro 1 del equipo debe forkear y clonar el repositorio. En Github, debe dar permisos al otro miembro para editar el repositorio (Repo > Settings > Collaborators and teams)
  • El otro miembro (Miembro 2), clona el repo desde la cuenta de Github del compañero (no hacer dos forks).
  • Miembro 1 crea una rama dev: git checkout -b dev
  • Miembro 1 hace una función cualquiera en el archivo index.js, los comitea en la rama dev y después sube los cambios la rama dev en remoto (Github): git push origin dev

Iteration 2: conflict is a part of life

  • Miembro 2, para traerse lo que hay en remoto, hace git pull
  • Miembro 2 se va a la rama dev: git checkout dev
  • DESDE DEV, crea una nueva rama: git checkout -b navbar
  • Crea una navbar en el archivo index.html
  • De mientras, Miembro 1 del equipo se queda en dev y genera a la vez una navbar en el archivo index.html. Cuando la acaba, comitea los cambios y los sube a la rama dev en remoto
  • Miembro 2, cuando acaba de hacer su navbar en la rama navbar, comitea los cambios en su rama
  • Miembro 2 se va a dev (git checkout dev), trae los cambios que ha hecho el otro compañero en remoto (git pull origin dev) y entonces procede a mergear su rama: git merge navbar
  • Como se han tocado las mismas líneas de código, debería haber conflicto. Solucionadlo y después comitear los cambios y subirlo a la rama dev.

📝 Git commands cheatsheet

Command Description
git checkout -b branch-name Create new branch AND move to it
git checkout branch-name Move to other branch
git pull Brings all changes in branches from remote to local
git pull origin branch-name Bring changes from specific remote branch
git stash Set aside changes without commiting them to change branches for a while
git stash pop Bring back the changes you stashed
git stash drop Dismiss the changes you stashed
git add . Add the files you want to commit or use "." if it is all of them
git commit -m "Commit name" Commit changes
git merge branch-name From the receiving branch, merge another branch
git push origin branch-name Update branch also on remote repository
git log --pretty=oneline See repository commits

⭐️ To add a tree command to see the tree version of the git log, run in any terminal:

git config --global alias.tree "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"

After this, you can run, on any project with git:

git tree

To quit the command line and get out of the log, run:

:q

To practise and improve your Git skills, follow this tutorial.


👯 Proceso para trabajar en pareja:

A) Cuando voy a empezar una nueva tarea

  1. Cuando voy a iniciar una nueva tarea, me voy a la rama dev (git checkout dev) y hago un git pull origin dev para sincronizar mi rama local de dev con lo que haya podido subir mi compañer@ a github
  2. Creo una rama con git checkout -b branch-name con el nombre del feature que voy a hacer, y muevo la targeta en el kanban como "In progress". Una rama también puede ser un bug
git checkout dev
git pull origin dev
git checkout -b feature-name

B) Cuando acabo la tarea

Cuando acabo la tarea de esa rama, la guardo y después me llevo los cambios a dev:

git status
git add .
git commit -m "Closed #number nombre tarea"
git push origin branch-name  # si quiero subir la rama a github para tener la copia ahí, este paso es opcional
git checkout dev  # me voy a la rama compartida
git pull origin dev # vuelvo a comprobar si mi compañer@ ha hecho cambios mientras yo trabajaba
git merge branch-name # me traigo los cambios que he hecho yo a la rama dev y si hay conflictos los arreglo
git commit -m "merges branch-name into dev" # guardo los cambios
git push origin dev # subo los cambios a github para que se los pueda descargar mi compañer@

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.