This repository has been archived by the owner on Dec 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Comandos_git.txt
76 lines (50 loc) · 4.07 KB
/
Comandos_git.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Los directorios en mingw64 se escriben asi: /c/programacion_uwu/1.proyectos
/c/users/jerem
/c/games
Comando: --version ->>
---------------------------------------------------------------------------------------------------------------------------------------------
Comando: git init -> Crea un repositorio git en la carpeta en la que se está.
Comando: git clone -> clona un repositorio
Comando: git add . -> Añadira al repositorio(local!) (aunque no es directamente al repositorio si no como a un lugar preenvio, se llama "Starting Area") todo el contendo de la carpeta en la que uno se encuentre. (Puede tardar si son muchos archivos xd).
git add nombre_del_archivo_.txt -> Solo se actualizara el archivo que se menciona. (poniendo unas cuantas letras del nombre del archivo y precionando TAB, se autocompletará)
Comando: git commit -m 'Aqui va el comentario' -> Sirve para añadir un comentario a la subida, aqui se debe indicar que fue lo que cambiamos.
El "-m" es como una opción pero ni idea de cual, ni de cuantas hay, y ni que es lo que hace xd.
Comando: git rm --cached NombreDelArchivo -> Hace que git deje de seguir el archivo que mandamos al "stagin area"
Comando: git log -> lista de commits.
git log > logs.txt -> Creara un archivo donde estaran todos los commits.
Comando: git remote add origin aqui_va_el_link -> Sincroniza nuestro respositorio en GitHub con nuestro repositorio local.
(Nos pedira que iniciemos sesion)
Comando: git push -u origin master -> Este comando enviara al respositoro todo nuestro git local al master!
(supongo que habra que cambiar el nombre "master" por la rama que necesitemos xd)
git push origin master -> hace lo mismo que el anterior xd.
Commando: git pull -> Actuliaza nuestro repositorio local con los cambios del repositorio externo.
Commando: git revert -> crea un nuevo commit para los cambios anteriores
Repetir estos tres comandos cada vez que se quiera actualizar el repositorio en GitHub:
git add .
git commit -m 'Aqui va el comentario'
git push -u origin master
Otra forma de subirlo es por vscode:
1. Ir a la parte de git.
2. Escribir el mensaje en el recuadro de la derecha (este es el commit)
3. Precionar el Ctrl+Enter para actualizar el repositorio local del master (como se hace con otros? ni idea xd)
4. Para subirlos a GitHub, precionar los tres puntitos y luego "Push".
5. Fijarse si funcionó xd.
---------------------------------------------------------------------------------------------------------------------------------------------
Comando: git satus -> Sirve para ver que archivos fueron modificados del repositorios.
Cuando un archivo no es rastreado (o sea que es nuevo xd) aparecera en rojo. tambien salen los que no en rojo, asi que ni puta idea.
En verde aparecen los archivos que estan listos para subirse.
Comando: git diff -> Muestra las diferencias de todos los archivos entre los que estan en el repositorio y los que uno esta modificando.
---------------------------------------------------------------------------------------------------------------------------------------------
Comando: git branch -> Muestra todas las ramas de nuestro repositorio local.
git branch -a -> Muestra todas las ramas del repositorio local y externo.
Comando: git branch NombreDeLaBranch -> Crea una nueva rama.
Comando: git checkout NombreDeLaBranch -> Cambia a la rama que nombramos.
1)Para merged una rama, primero debemos estar en la rama a la que queremos hacer merged.
2)Luego hacemos pull para tener el codigo (en este ejemplo master) actualizado.
3)Podemos ver todas las ramas que merged.
Comando: git branch --merged
4)mergeamos la rama que queremos.
Comando: git merge NombreDeLaBranch
Comando: git push origin --delete NombreDeLaBranch -> Elimina una rama del repositorio remoto.
git branch -d NombreDeLaBranch -> Elimina la rama del repositorio local.
--------------------------------------------------------------------------------------------------------------------------------------------