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
|
set git using *ssh* rather than *https*: git remote set-url origin git@github.com:x423xu/x423xu.github.io
create branch: git checkout --orphan branch-name
git push:
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/x423xu/x423xu.github.io.git
git push -u origin main
git set remote url:
git remote set-url origin xxx
!ERROR: Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (e.g., 'git pull ...') before pushing again.
git push -f origin main
#comment: this error is caused by the difference of local branch and remote branch. with '-f' arg, the local branch will be forced to update to the remote.
configure github login with access token:
gh auth login
delete remote branch or local branch:
git push origin --delete main #delete
git branch -D main #local
create local branch:
git branch main
switch to a different branch:
git checkout xxx
add all files to branch:
git add -f .
uncommit 1 committing: git reset HEAD~1
|