forked from cycl0ne/poweros_x86
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git_commands.txt
98 lines (81 loc) · 3.49 KB
/
git_commands.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
91
92
93
94
95
96
For getting a fork of this project:
goto github website and login
goto cycl0ne's repository (https://github.com/cycl0ne/poweros_x86) in github website
click on Fork.
https://github.com/snayaksnayak/poweros_x86.git gets created.
now goto working folder in your PC
#git clone https://github.com/snayaksnayak/poweros_x86.git
#cd poweros_x86
#git remote show origin
#git remote add upstream https://github.com/cycl0ne/poweros_x86.git
#git remote show upstream
For daily work:
#git checkout -b a_feature_branch
#git branch -va
#touch hello.c (create new file hello.c)
#vim hi.c (modify existing file hi.c)
#git meld (to see the diff) (https://github.com/wmanley/git-meld)
#git status
#git add hi.c hello.c (these new or modified files will be commited next)
#git checkout -- hurray.c (to undo changes in hurray.c)
#git rm --cached somefile.txt (untrack a tracked file)
#git status
#git commit -m "comment"
#git clean -dnx | cut -c 14- (to check unversioned files and dirs)
#git clean -dxf (to remove unversioned files and dirs) (consider #echo > ./.gitignore)
#git log --graph --abbrev-commit --decorate --all --full-history --pretty=format:"%h%x09%d%x20%s"
#git checkout master
#git branch -va
#git merge --no-ff a_feature_branch
#git push origin master
#git push -u origin a_feature_branch
loop above steps.
For getting new things from cycl0ne's repository:
#git fetch upstream
#git merge --no-ff upstream/master
#git mergetool
(in meld tool, do modifications to file shown in middle tab and save;
first press "merge all non conflicting",
then see what to be done for conflicting things showing in red,
there must be at least one conflicting thing)
#git status
#git commit -m "comment"
#git meld e91bdff ee6d110 (to see diff between two commits e91bdff and ee6d110)
#git meld HEAD~1 HEAD (to see diff between HEAD-1 and HEAD)
#git push origin master
Goto github website and check your master updated.
delete a local branch
#git branch -D gfxtest
undo stagging area changes and working area changes
#git reset --hard HEAD
undo a commit permanently
#git reset --hard HEAD~1
merge from a upstream branch to local branch
#git checkout -b gfxtest
#git fetch upstream
#git merge --no-ff upstream/development
#git mergetool
(in meld tool, do modifications to file shown in middle tab and save;
first press "merge all non conflicting",
then see what to be for conflicting things showing in red,
there must be at least one conflicting thing)
to see config items:
for all users (collected from /etc/gitconfig)
#git config --system --list
for current user (collected from ~/.gitconfig)
#git config --global --list
for current repository (collected from .git/config)
#git config --list
for creating a new repository (go inside the working folder)
#git init
for adding files for commit
#git add -A (stages "new untracked files" and "modified files" and "deleted files")
#git add . (stages "new untracked files" and "modified files", but not "deleted files")
#git add -u (stages "modified files" and "deleted files", but not "new untracked files")
if you want to undo things (after you do a merge and before commiting it) do
#git reset --merge
#git clean -dxf
if you delete a tracked file from git, it shows, that file as deleted. You have to do the following to commit it.
#git rm a.txt
to see changed files and their status from git log
#git log --name-status