-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit commands.sh
More file actions
50 lines (36 loc) · 1.22 KB
/
git commands.sh
File metadata and controls
50 lines (36 loc) · 1.22 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
# stage all tracked files and commit your changes
git commit -am "your commit message"
# stage all files, both tracked and untracked, and commit your changes
git add -A && git commit -m "save"
# empty git commit
git commit --allow-empty -m ""
# Push your branch to the remote repository:
git push --set-upstream origin feature_branch_name
# update local repo
git pull --all
# prune
git remote prune origin --dry-run
git remote prune origin
# delete branch
git checkout main
git branch -D feature_branch_name
# git stash
git stash save "my messsage"
git stash list
git stash apply stash@{0}
# get the first item on the stash list
git stash pop
# delete a stashed item
git stash drop stash@{0}
# delete all stashed items
git stash clear
# clone one branch
git clone -b go-scientist-graphql git@git-ssh.deepl.dev:deepl/dap/dap.git
# clone to a specific directory
git clone git@github.com:ClickHouse/dbt-clickhouse.git oss-dbt-clickhouse
# copy a directory from another branch huhu to the current branch
git checkout huhu -- path/to/directory
# output last 10 git commit logs
git log -10 --pretty=format:"%h%x09%cd%x09%an%x09%s" --date=format:"%Y-%m-%d %H:%M:%S" | cat
# reset local branch to remote branch
git fetch && git reset --hard @{u}