-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit_ref.txt
57 lines (47 loc) · 1.21 KB
/
git_ref.txt
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
1. To change the email address associated with your Git commits globally:
```
git config --global user.email "[email protected]"
```
2. To change the email address associated with your Git commits for a specific repository:
```
git config user.email "[email protected]"
```
3. To create a new branch in Git:
```
git branch new-branch-name
```
4. To switch to a different branch:
```
git checkout branch-name
```
5. To add a remote repository:
```
git remote add origin <remote-url>
```
6. To verify the remote repository URL:
```
git remote -v
```
7. To commit changes:
```
git commit -m "Your commit message"
```
8. To push a branch to a remote repository:
```
git push -u origin branch-name
```
9. To change the author email of existing Git commits:
```
git filter-branch --env-filter '
if [ "$GIT_COMMITTER_EMAIL" = "<old-email>" ]; then
export GIT_COMMITTER_EMAIL="<new-email>"
fi
if [ "$GIT_AUTHOR_EMAIL" = "<old-email>" ]; then
export GIT_AUTHOR_EMAIL="<new-email>"
fi
' -- --all
```
10. To force-push the changes to the remote repository after modifying the commit history:
```
git push --force --all
```