-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpful-git-commands.ps1
More file actions
94 lines (64 loc) · 1.71 KB
/
helpful-git-commands.ps1
File metadata and controls
94 lines (64 loc) · 1.71 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Git: Initialize a new Git repository
git init
# Git: Clone an existing repository
git clone <repository-url>
# Git: Check the current status
git status
# Git: Add files to staging area
git add <file>
git add .
# Git: Commit changes
git commit -m "Your commit message"
# Git: View commit history
git log
git log --oneline
# Git: Create a new branch
git checkout -b <branch-name>
# Git: Switch between branches
git checkout <branch-name>
# Git: List all branches
git branch
# Git: Merge a branch into the current branch
git merge <branch-name>
# Git: Delete a branch
git branch -d <branch-name>
# Git: Push local changes to a remote repository
git push origin <branch-name>
# Git: Pull changes from a remote repository
git pull origin <branch-name>
# Git: Fetch changes from a remote repository without merging
git fetch origin
# Git: Set a remote URL
git remote add origin <repository-url>
# Git: Discard local changes
git checkout -- <file>
# Git: Remove a file from staging area
git reset <file>
# Git: Undo the last commit
git reset --soft HEAD~1
# Git: Reset a branch to a previous state
git reset --hard <commit-hash>
# Git: Stash uncommitted changes
git stash
# Git: Apply stashed changes
git stash apply
# Git: List all stashes
git stash list
# Git: Create a new tag
git tag <tag-name>
# Git: List all tags
git tag
# Git: Push a tag to remote repository
git push origin <tag-name>
# Git: View changes between commits
git diff <commit1> <commit2>
# Git: Show changes in the working directory
git diff
# Git: Show a specific commit
git show <commit-hash>
# Git: Show remote repositories
git remote -v
# Git: Rename a remote
git remote rename <old-name> <new-name>
# Git: Remove a remote
git remote remove <remote-name>