Skip to content

Commit 7c74df0

Browse files
committed
Update blog/_posts/2019-06-29-git.markdown via blog editor
1 parent ab3b733 commit 7c74df0

1 file changed

Lines changed: 85 additions & 84 deletions

File tree

blog/_posts/2019-06-29-git.markdown

Lines changed: 85 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -7,88 +7,89 @@ published: true
77
description:
88
---
99

10-
Amazing presentation:
11-
https://docs.google.com/presentation/d/1IQCRPHEIX-qKo7QFxsD3V62yhyGA9_5YsYXFOiBpgkk/view#slide=id.g4d6b1121f4_2_60
12-
13-
https://github.com/git/git/tree/e83c5163316f89bfbde7d9ab23ca2e25604af290?s=09
14-
15-
"git" can mean anything, depending on your mood.
16-
17-
## configuration
18-
19-
Asking user and password every time:
20-
Make sure you are using ssh instead of HTTP protocol. See which one you are using with
21-
```
22-
git config -l
23-
```
24-
25-
And if you need to update it, do it like this:
26-
```
27-
git config remote.origin.url git@github.com:alanboy/project.git
28-
```
29-
## submodules
30-
31-
Git submodules
32-
```
33-
git submodule update --init --recursive
34-
```
35-
36-
## squash
37-
38-
https://stackoverflow.com/questions/25356810/git-how-to-squash-all-commits-on-branch/25357146#25357146
39-
40-
41-
```
42-
git checkout yourBranch
43-
git reset $(git merge-base master yourBranch)
44-
git add -A
45-
git commit -m "one commit on yourBranch"
46-
```
47-
48-
## reset
49-
50-
Git reset will move the HEAD and/or the branch pointer.
51-
52-
```
53-
git reset --soft HEAD~5
54-
```
55-
Reset local repository branch to be just like remote repository HEAD
56-
57-
```
58-
git fetch origin
59-
git reset --hard origin/master
60-
```
61-
62-
Note: `HEAD~` means HEAD minus 1 commits, `HEAD~3` means HEAD minus 3 commits.
63-
64-
git merge --squash users/alango/authz
65-
66-
## Github and credentials
67-
68-
Install `gh`:
69-
```
70-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
71-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
72-
sudo apt update
73-
sudo apt install gh
74-
```
75-
Then you can login using a PAT:
76-
```
77-
gh auth login
78-
```
79-
80-
81-
https://github.com/cli/cli/blob/trunk/docs/install_linux.md
82-
https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git
83-
84-
## Internals
85-
https://yurichev.com/news/20201220_git/
86-
87-
## References
88-
89-
90-
https://stackoverflow.com/questions/1628088/reset-local-repository-branch-to-be-just-like-remote-repository-head
91-
http://fabiensanglard.net/git_code_review/diff.php
92-
https://github.com/HerCerM/ManualDefinitivoGit/blob/master/Parte2_Profundizando.md
93-
https://pre-commit.com/
10+
11+
"git" can mean anything, depending on your mood. [Source](https://github.com/git/git/tree/e83c5163316f89bfbde7d9ab23ca2e25604af290?s=09
12+
)
13+
14+
## configuration
15+
16+
Asking user and password every time:
17+
Make sure you are using ssh instead of HTTP protocol. See which one you are using with
18+
```
19+
git config -l
20+
```
21+
22+
And if you need to update it, do it like this:
23+
```
24+
git config remote.origin.url git@github.com:alanboy/project.git
25+
```
26+
## submodules
27+
28+
Git submodules
29+
```
30+
git submodule update --init --recursive
31+
```
32+
33+
## squash
34+
35+
```
36+
git checkout yourBranch
37+
git reset $(git merge-base master yourBranch)
38+
git add -A
39+
git commit -m "one commit on yourBranch"
40+
```
41+
[Source](
42+
https://stackoverflow.com/questions/25356810/git-how-to-squash-all-commits-on-branch/25357146#25357146)
43+
44+
## reset
45+
46+
Git reset will move the HEAD and/or the branch pointer.
47+
48+
```
49+
git reset --soft HEAD~5
50+
```
51+
Reset local repository branch to be just like remote repository HEAD
52+
53+
```
54+
git fetch origin
55+
git reset --hard origin/master
56+
```
57+
58+
Note: `HEAD~` means `HEAD` minus 1 commits, `HEAD~3` means `HEAD` minus 3 commits.
59+
60+
```
61+
git merge --squash users/alango/authz
62+
```
63+
64+
## Github and credentials
65+
66+
Install `gh`:
67+
```
68+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
69+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
70+
sudo apt update
71+
sudo apt install gh
72+
```
73+
Then you can login using a PAT:
74+
```
75+
gh auth login
76+
```
77+
78+
79+
https://github.com/cli/cli/blob/trunk/docs/install_linux.md
80+
https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git
81+
82+
## Internals
83+
https://yurichev.com/news/20201220_git/
84+
85+
## References
86+
87+
**Amazing presentation**:
88+
https://docs.google.com/presentation/d/1IQCRPHEIX-qKo7QFxsD3V62yhyGA9_5YsYXFOiBpgkk/view#slide=id.g4d6b1121f4_2_60
89+
90+
91+
https://stackoverflow.com/questions/1628088/reset-local-repository-branch-to-be-just-like-remote-repository-head
92+
http://fabiensanglard.net/git_code_review/diff.php
93+
https://github.com/HerCerM/ManualDefinitivoGit/blob/master/Parte2_Profundizando.md
94+
https://pre-commit.com/
9495
https://www.youtube.com/watch?v=Flho9VgaZ_g&ab_channel=javaM%C3%A9xico

0 commit comments

Comments
 (0)