-
Notifications
You must be signed in to change notification settings - Fork 0
/
txt
90 lines (53 loc) · 3.16 KB
/
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
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
-> we can firstly ( init) the git then
-> Then use git add . to add all the file to the tracking .
-> Then use git commit -m "message" to commit the file to the local
repository .
-> Then use git push origin master to push the file to the remote repository .
-> we can see commits using the git log .
-> we can also see the commit line by line using the git diff .
-> we can also see the status of the file using the git status .
-> to quite the git log we press q.
-> u--> Unchecked , a--> checking , m --> modifies
-> we used the git staged , when the change done but not commits
-> the step for the commit is that :-
Step 1: local storage
Step 2: staging area
Step 3: commit
->[ git show commit_id ,] show us all the changes happen in the file .
-> [git blame file_name ] it shows that who changes the code and when .
Note : make the commit clean , mean do a one thing then commit , it make the tracking easy.
-> commit is like the link list , so the head is point toward the latest commit .
-> if there was the error commit in the log and we have to revert then we can use[ git reset --hard commit_id].
-> if we want to revert the particular commit then we use [git revert commit_id]
-> to connect our local file to the center server like the gitHub
we use [git remote add origin (server name {can be any thing ,default is origin repo address (from git hub)})]
-> By using git push origin main , we add our changes to the repo.
->the real process to push in to the repos is :-
Step 1: Fetch and Merge the Latest Changes
First, fetch the latest changes from the remote repository,Then, merge the changes into your local branch:
git fetch origin
git merge origin/main
Step 2: Push Your Changes
git push origin main
-> We can have the multiple remote , it is basically use in the open Source
Note: git pull do fetching and merging same time, while git fetch has separate .
BRANCHING
-> Branching is a way to work on a feature independently of any other work. It allows you to create a new line of development from an existing.
-> we can create the branch using the git branch branch_name
-> we can switch to the branch using the git checkout branch_name
-> we can delete the branch using the git branch -d branch_name
-> we can merge the branch using the git merge branch_name
-> we use the [git push --set-upstream branch_name subbranch_name] to push the subbranch in the main branch .
-> how to merge the new branch in the main branch of the remote server :-
CLI Method (command line interface)
Step 1 : go to main branch
Step 2 : git merge origin/Sub_branch_name
Step 3 : git push
Naming Of Branch :-
wip Works in progress; stuff I know won't be finished soon
feat Feature I'm adding or expanding
bug Bug fix or experiment
junk Throwaway branch created to experiment
Example=> "feat/add-the-chat-support"
-> git checkout -b feat/add-the-chat-support
-> we use git rebase when we have to main the commit history of the other subbranch in hte main branch. it added all the commit in the main commit history unlike the merge , who combine all the commit of the sub_branch merge it st once