-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-commands.txt
More file actions
83 lines (41 loc) · 2.51 KB
/
git-commands.txt
File metadata and controls
83 lines (41 loc) · 2.51 KB
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
GitHub/settings/email
git config --global user.name "LoveTechCode"
git config --global user.email "51445557+LoveTechCode@users.noreply.github.com"
git config list
ir al directorio donde inciar el git: git init .
git status
git log
git log --oneline
git log -p
Add to stage: git add <file.txt>
Remove from stage: git restore --staged <file.txt>
Move from stage to master: git commit .
git commit -m "mensaje"
Change commit comments: git amend ???
In master/main:
create a new branch: git branch <new-branch-name>
activate branch: git checkout <new-branch-name>
All in once: git checkout -b <new-branch-name>
To see all branches and active: git branch
Change name to branches
1) get within the branch: git branch -m <new-name>
2) from any branch: git branch -m <old-name> <new-name>
No estar en la rama, solo locales, no publicadas en GitLab
Delete a branch: git branch -d <name-branch>
Estar en la rama que recibira los cambios - master/main:
Merge : git merge <rama origen> <rama destino>
#----------- GitLab ---------------------------------------------------------
Tokens: <ver fichero pwd>
Profile (foto) / Settings / <> Developer settings / Personal access tokens
Copy en local un remoto: git clone https://github.com/LoveTechCode/git-commands.git
Interact with remote: git remote -v
Enviar cambios al repo origen: git push origin main "enviar a origin (remote) from branch main (local)"
Obtener todo del repo origin: git pull origin main "obtener cambios de origin (remoto) y ponerlos en main (local)"
Comprueba si hay cambios del repo origin: git fetch origin main "solo chequea si hay cambios en origin (remote), no los baja a main (local)"
Para ver los cambios en origin(remote): git checkout origin/main "nos movemos a GitHub a la rama main"
Subir un main (local) a GitHub (vacio)
1. Remote: Crear repo vacio en GitHub (darle un nombre, no hace falta que sea el del local)
2. Local: ir a la carpeta y hacer: git init .
git remote -v ---> (vacio) no habra ningun origin definido en local
git remote add origin <https://GitHub-repo>
git push origin main