-
Notifications
You must be signed in to change notification settings - Fork 0
/
git_concept.txt
25 lines (18 loc) · 1.71 KB
/
git_concept.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
2nd file
User 1: Local Repo/folder : Git bash -> here user 1 can commit the changes personally
User 2: Local Repo/folder : Git bash -> here user 2 can commit the changes personally
Git Server -> to collaborate between user 1 and user 2. This can be achieved by using git push and git pull command and git branch and merge stuff
- the server is nothing but github website which is protected by username and password for each user
-> You should always create the server Repo name and local Repo name same to same
adding any file is a two step process:
working copy -> stagin area -> repository -> git server
add commit push
// Rolling for older version
1st commit >> 2nd commit >> 3rd commit >> 2nd commit (this is roll back to prev version)
// here in git we kind of never delete any commit rather we go in linear fasion
// Resetting the Head to some other commit in the history
Lets say you have multiple commits in your local Repo. Now you want to roll back the any particular commit in past. You can use "git reset --soft <repo version>" to do this keeping other future changes in the staged state. You can check the same using "git status" command.
So basically git reset --soft just resets the git head while keeping all the changes intact from the file.
Precaution: Do this only when your changes are local not pushed yet.
Once you have pushed your stuff on the server with multiple contributors working on it... then the best practice is never back in history... as other contributors will get affected by yout move.
So even if you wanted some commits to be removed... you need to use "git revert <repo version>" which will undo the chages based on given repo version and a new commit on top of every thing