-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSETUP_GIT_ALIASES.sh
More file actions
executable file
·79 lines (66 loc) · 2.14 KB
/
Copy pathSETUP_GIT_ALIASES.sh
File metadata and controls
executable file
·79 lines (66 loc) · 2.14 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
73
74
75
76
77
78
79
#!/bin/bash
# 🚀 Git Aliases & Functions Setupi
# Bu dosyayı ~/.bashrc veya ~/.zshrc'ye ekle
# Git alias'ları ekle
cat >> ~/.bashrc << 'ALIASES'
# === GIT ALIASES ===
alias gs='git status' # Status
alias ga='git add -A' # Add all
alias gc='git commit -m' # Commit
alias gp='git push' # Push
alias gl='git log --oneline -n 10' # Log (10 lines)
alias gll='git log --graph --oneline --all' # Log (graph)
alias gd='git diff' # Diff
alias gdc='git diff --cached' # Diff staged
alias gb='git branch -a' # Branches
alias gco='git checkout' # Checkout
alias greset='git reset --hard HEAD' # Reset (DANGER!)
alias gundo='git reset --soft HEAD~1' # Undo last commit
alias gstash='git stash' # Stash
alias gpop='git stash pop' # Unstash
# === GIT FUNCTIONS ===
# Quick commit + push
gcp() {
git add -A
git commit -m "$1"
git push
}
# Safe undo (doesn't delete files)
gundo() {
git reset --soft HEAD~1
echo "✓ Last commit undone (files preserved)"
}
# View specific commit
gshow() {
git show "$1"
}
# Create new feature branch
gfeat() {
git checkout -b "feature/$1"
echo "✓ Created feature branch: feature/$1"
}
# Push new branch
gpush-new() {
git push -u origin "$(git rev-parse --abbrev-ref HEAD)"
echo "✓ Pushed new branch"
}
# Current branch info
ginfo() {
echo "📊 Git Repository Info:"
echo "Branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Remote: $(git config --get remote.origin.url)"
echo "Commits: $(git rev-list --count HEAD)"
echo "Last: $(git log -1 --pretty=format:'%s')"
}
# Cleanup
gclean() {
git clean -fd
echo "✓ Cleaned untracked files"
}
ALIASES
echo "✅ Git aliases added to ~/.bashrc"
echo ""
echo "Reload your shell:"
echo " source ~/.bashrc"
echo ""
echo "Or logout and login again"