Skip to content

Commit

Permalink
mastermain
Browse files Browse the repository at this point in the history
  • Loading branch information
parkerbxyz authored Oct 26, 2022
1 parent 495af61 commit b48e26d
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 45 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ If you aren't sure how to fix it or just don't have time, we invite you to open
Several community members have been kind enough to translate the Git Cheat Sheets into various languages. At this time, we are only set up to serve the cheat sheets in various languages (but maybe you can help us change that 😉). If you are planning to contribute a translation, please do the following:

- Fork this repository
- Create a new folder in the [downloads directory](https://github.com/github/training-kit/tree/master/downloads) using the standard abbreviation for the language you are providing.
- Copy the most recent [English version of the cheat sheet](https://github.com/github/training-kit/blob/master/downloads/github-git-cheat-sheet.md) to the folder you created.
- Create a new folder in the [downloads directory](https://github.com/github/training-kit/tree/main/downloads) using the standard abbreviation for the language you are providing.
- Copy the most recent [English version of the cheat sheet](https://github.com/github/training-kit/blob/main/downloads/github-git-cheat-sheet.md) to the folder you created.
- Complete the translation
- Add a link to the translated resource on [/index.html](https://github.com/github/training-kit/blob/master/index.html)
- Add a link to the translated resource on [/index.html](https://github.com/github/training-kit/blob/main/index.html)
- Open a pull request against the `main` branch of this repository.
- Be sure to @ mention a couple of your friends who are native speakers and ask them to review the translation.
- Update your translation based on feedback from your friends.
Expand Down
38 changes: 23 additions & 15 deletions downloads/es_ES/submodule-vs-subtree-cheat-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ leadingpath: ../../
</div>

{% capture submodule %}

### Submódulo

git submodule add https://github.com/githubtraining/submodulo-ejemplo
Expand All @@ -25,8 +26,7 @@ El comando `submodule add` agrega un nuevo archivo llamado `.gitmodules` junto c

### Subárbol


git subtree add --prefix=submodulo-ejemplo https://github.com/githubtraining/submodulo-ejemplo master --squash
git subtree add --prefix=submodulo-ejemplo https://github.com/githubtraining/submodulo-ejemplo main --squash

El comando `subtree add` agrega un subdirectorio que contiene los archivos de `submodulo-ejemplo`. La práctica más común es utilizar la opción `--squash` para combinar el historial del subproyecto en un único commit, que luego se inserta en el árbol existente del proyecto principal. Se puede omitir la opción `--squash` para mantener todo el historial de la rama seleccionada del subproyecto.

Expand All @@ -45,9 +45,10 @@ El comando `subtree add` agrega un subdirectorio que contiene los archivos de `s
</div>

{% capture submodule %}

### Submódulo

Para ver las diferencias (`diff`) de un submódulo:
Para ver las diferencias (`diff`) de un submódulo:

```bash
# mostrar cambios al commit del submódulo
Expand Down Expand Up @@ -81,6 +82,7 @@ No se requiere ningún comando especial
</div>

{% capture submodule %}

### Submódulo

Para clonar un repositorio junto con su submódulo:
Expand Down Expand Up @@ -116,10 +118,11 @@ No se requiere ningún comando especial
</div>

{% capture submodule %}

### Submódulo

De forma predeterminada, el repositorio del submódulo se recupera, pero no se actualiza cuando ejecuta `git pull` en el superproyecto.
Se necesita usar `git submodule update`, o agregar ` --recurse-submodules` a `pull`:
Se necesita usar `git submodule update`, o agregar `--recurse-submodules` a `pull`:

```bash
git pull
Expand Down Expand Up @@ -164,13 +167,13 @@ No se requiere ningún comando especial
</div>

{% capture submodule %}
### Submódulo

### Submódulo

De forma predeterminada, el árbol de trabajo del submódulo no se actualiza para que coincida con el commit registrado en el superproyecto al cambiar de rama.
Necesita usar `git submodule update`, o agregar` --recurse-submodules` a `checkout`:
Necesita usar `git submodule update`, o agregar`--recurse-submodules` a `checkout`:

```bash
```bash
git checkout <branch>
git submodule update --recursive
# o, en un comando (Git >= 2.13)
Expand Down Expand Up @@ -200,6 +203,7 @@ No se requiere ningún comando especial
</div>

{% capture submodule %}

### Submódulo

```bash
Expand All @@ -211,7 +215,7 @@ git commit -am "Update submodule"

Si tiene más de un submódulo, puede agregar la ruta al submódulo al final del comando `git submodule update --remote` para especificar qué subproyecto actualizar.

Por defecto, `git submodule update --remote` actualizará el submódulo al último commit en la rama` master` del submódulo remoto.
Por defecto, `git submodule update --remote` actualizará el submódulo al último commit en la rama`main` del submódulo remoto.

Se puede cambiar la rama predeterminada para futuras llamadas con:

Expand All @@ -227,13 +231,14 @@ git config -f .gitmodules submodule.example-submodule.branch otra-rama
{% capture subtree %}

### Subárbol
git subtree pull --prefix=submodulo-ejemplo https://github.com/githubtraining/submodulo-ejemplo master --squash

git subtree pull --prefix=submodulo-ejemplo https://github.com/githubtraining/submodulo-ejemplo main --squash

Se puede acortar el comando agregando la URL del subárbol como remoto:

git remote add sub-remote https://github.com/githubtraining/submodulo-ejemplo.git

Se pueden utilizar los commandos add/pull de otras referencias reemplazando `master` con la referencia deseada (e.g. `stable`, `v1.0`).
Se pueden utilizar los commandos add/pull de otras referencias reemplazando `main` con la referencia deseada (e.g. `stable`, `v1.0`).

{% endcapture %}

Expand All @@ -252,12 +257,13 @@ Cuando esto no sea práctico, siga estas instrucciones:
</div>

{% capture submodule %}

### Submódulo

Acceda al directorio del submódulo y cree una rama:

cd example-submodule
git checkout -b nombre-rama master
git checkout -b nombre-rama main

Los cambios requieren dos commits, una en el repositorio del subproyecto y otra en el repositorio principal.
¡No olvides agregar tanto el submódulo como el superproyecto!
Expand Down Expand Up @@ -286,6 +292,7 @@ Es posible crear commits mezclando cambios en el subproyecto y el proyecto princ
</div>

{% capture submodule %}

### Submódulo

Mientras está en el directorio del submódulo:
Expand All @@ -301,7 +308,8 @@ O mientras está en el directorio principal:
{% capture subtree %}

### Subárbol
git subtree push --prefix=submodulo-ejemplo https://github.com/githubtraining/submodulo-ejemplo master

git subtree push --prefix=submodulo-ejemplo https://github.com/githubtraining/submodulo-ejemplo main
{% endcapture %}

<div class="col-md-6">
Expand All @@ -324,11 +332,11 @@ Muestre un breve resumen de los cambios del submódulo en su mensaje `git status

git config --global status.submoduleSummary true

Haga que `push` sea predeterminado en` --recurse-submodules = on-demand`:
Haga que `push` sea predeterminado en `--recurse-submodules = on-demand`:

git config --global push.recurseSubmodules on-demand

Haga que todos los comandos (excepto `clone`) estén predeterminados en` --recurse-submodules` si admiten la bandera (esto funciona para `git pull` desde Git 2.15):
Haga que todos los comandos (excepto `clone`) estén predeterminados en `--recurse-submodules` si admiten la bandera (esto funciona para `git pull` desde Git 2.15):

git config --global submodule.recurse true

Expand Down
43 changes: 25 additions & 18 deletions downloads/github-git-concepts_BETA.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,41 @@ Git is an open source, distributed version control system founded in command lin
With a language all its own, this quick guide to common terms of GitHub and Git will have you collaborating in no time.

### Repository

A repository is the most basic element of Git and GitHub. Imagine it as a project's folder. A repository contains all of the project files (including documentation), and stores each file's revision history.

### Commit

An individual change to a file (or set of files). With Git, every time you save it creates a unique ID (a.k.a. the "SHA" or "hash") that allows you to keep record of what changes were made when and by who. Commits usually contain a commit message which is a brief description the changes made.

### Branch
A parallel version of repository. It is contained within the repository, but does not affect the primary or master branch allowing you to work freely without disrupting the "live" version.

A parallel version of repository. It is contained within the repository, but does not affect the main branch, allowing you to work freely without disrupting the "live" version.

### Remote

The connection of a local repository with one on GitHub. It permits revision history to be synchronized by publishing local commits and downloading any new changes from GitHub.

### Pull Request

A feature on GitHub which provides conversation, line-by-line code review, change history analysis, and summaries of modified files.

## Configuring

The first thing to setup when using Git is two important fields about the user. This allows appropriate credit and traceability for project contributions.

```
$ git config --global user.name "Mona Lisa Octocat"
$ git config --global user.email "[email protected]"
git config --global user.name "Mona Lisa Octocat"
git config --global user.email "[email protected]"
```

## Versioning Files

Versioning files begins by creating a repository on your GitHub account. File authoring and editing can be performed through the web interface or by acquiring the repository locally from the command line.

```
$ git clone [url] [project-name]
$ cd [project-name]
git clone [url] [project-name]
cd [project-name]
```

Repository contributions are commonly made through branches and commits focused on small pieces of work.
Expand All @@ -50,7 +56,7 @@ git commit -m [commit message]
When the feature work reaches completion, the branch can be merged locally or pushed to GitHub for code review.

```
git switch master
git switch main
git merge [branch]
git push -u origin [branch]
Expand All @@ -59,43 +65,44 @@ git push -u origin [branch]
As commits can be efficiently made, the state of any new, modified, or missing files can be verified and quickly validated.

```
$ git status
$ git diff [modified-file]
git status
git diff [modified-file]
```

## Integrating Changes
Commits can be made against any branch and in any order. Commonly, this is performed against the master branch as means of feature or bug-fix integration.

Commits can be made against any branch and in any order. Commonly, this is performed against the main branch as means of feature or bug-fix integration.

```
$ git switch master
$ git merge feature-enhancement
$ git branch -d feature-enhancement
git switch main
git merge feature-enhancement
git branch -d feature-enhancement
```

[PLACEHOLDER - Recursive Merge Diagram]

The last step deletes the branch. Merges result in all commit history becoming traversible, and eliminating the need for the branch label to remain.


## Sharing & Retrieving

Sharing commit history requires only a destination repository, one on GitHub, and a single setup step.

```
$ git remote add origin [repo-url]
$ git remote -v
git remote add origin [repo-url]
git remote -v
```

[PLACEHOLDER - Local-Upstream Diagram]

With a remote setup, and the traditional name of "origin" aliased to the URL, publishing local commits is simple.

```
$ git push origin [branch-name]
git push origin [branch-name]
```

Retrieving changes from a shared repository and automatically merging in any new commits locally is performed in a multi-step operation run by one command.

```
$ git switch [target-branch]
$ git pull origin [upstream-branch]
git switch [target-branch]
git pull origin [upstream-branch]
```
Loading

0 comments on commit b48e26d

Please sign in to comment.