-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-helper.txt
44 lines (29 loc) · 1.77 KB
/
git-helper.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
first of all HEAD is a pointer, out working things are always in a pointer named HEAD.
we can change HEAD position using checkout
----------------------------------------------------------
showing all branch log--
git log --all --oneline
----------------------------------------------------------
showing current branch log
git log --oneline
----------------------------------------------------------
rollback to any previous commit (no new commit will be executed, this for the time when we just need to go to a previous version and it wont
matter if the commits after the given "commit_id" is deleted)
git reset <commit_id>
git push --force
----------------------------------------------------------
now if we want to go to a previous version but we don't want to delete the commits that are committed after the given "commit_id" then
we should use revoke
a good tutorial link
https://www.freecodecamp.org/news/git-revert-commit-how-to-undo-the-last-commit/
https://stackoverflow.com/questions/4114095/how-do-i-revert-a-git-repository-to-a-previous-commit
git revert --no-commit <commit_id> -m 1(m is needed if there is a merge commit in between head and
git --continue
----------------------------------------------------------
git branch -av => shows all the local branches and the local version of the corresponding remote branches
git pull => pulls all the remote branch updated version to local origin/<branch_name>
git merge origin/<branch_name> => merge current HEAD position with the given <branch_name>
----------------------------------------------------------
removing a file
[a link](https://stackoverflow.com/questions/2047465/how-can-i-delete-a-file-from-a-git-repository/2047477)
----------------------------------------------------------