Saltar al contenido ForoHackers

Version control: start here

Control de versiones
#3349 · · Citar · Denunciar

Version control records every change to a set of files, who made it and why, so you can go back, compare, and work in parallel without overwriting each other. Today that almost always means Git. It is the safety net under every serious project, and the history it keeps is documentation.

Key concepts

  • Commits as snapshots: each commit stores the state of the tree, a message and a link to its parent.
  • Branches: cheap pointers to a line of work; you start one for each idea.
  • Merging and rebasing: two ways to combine lines of work, one keeping the shape of history and one rewriting it.
  • Remotes: other copies of the repository you push to and pull from; every clone holds the full history.
  • Good history: small commits, each with one purpose and a message that says why.

Vocabulary

  • Staging area: where you assemble the next commit.
  • HEAD: the commit you are standing on.
  • Conflict: two changes touch the same lines and a person must decide.
  • Tag: a permanent name for one commit, such as a release.

What to study, in order

  1. Make a repository, commit, branch, merge, and read the log with its graph view.
  2. Cause a merge conflict on purpose and resolve it by hand.
  3. Learn the object model: blobs, trees, commits, and how a branch is just a pointer.
  4. Practise rebasing a private branch, and the rule never to rewrite history others have pulled.
  5. Recover from mistakes with the reflog, revert and bisect.

Related tags

#code-review #ci-cd #open-source #developer-tools

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder