-
Notifications
You must be signed in to change notification settings - Fork 1
/
gitcmds.txt
70 lines (52 loc) · 1.72 KB
/
gitcmds.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
git init
git config --global core.excludesfile ~/.gitignore
git remote add origin https://github.com/trohit/visify.git
find . -name \*.sw\*
git status
OR
git status --porcelain
#to see modified /added/changed code
git diff
#to list all git files
git ls-files
git add *
git commit -m "second commit"
git push -u origin master
the 'git rm --cached <filename>' trick: This removes it from your index.
A git status will then inform you that it is now a deleted file, and that the
delete is scheduled to be committed, even if you add it to your .gitignore
file.
When you commit, the file is removed from your repo.
# if you dont want to remove from git, but just dont want git to update it
git update-index --assume-unchanged <file>
and to undo
git update-index --no-assume-unchanged <file>
#PEDANTIC
#to see git files in detail
git ls-files
# to see what files exist locally but removed from git
git status --porcelain | awk 'match($1, "D"){print $2}'
#to remove the files locally
git status --porcelain | awk 'match($1, "D"){print $2}' | xargs git rm
# CHRONO
Quick setup — if you've done this kind of thing before
or
HTTPS SSH
We recommend every repository include a README, LICENSE, and .gitignore.
…or create a new repository on the command line
echo "# visify" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/trohit/visify.git
git push -u origin master
…or push an existing repository from the command line
git remote add origin https://github.com/trohit/visify.git
git push -u origin master
# adding a commit
git add
git commit -m "description"
git push origin master
http://rogerdudler.github.io/git-guide/
# equivalent of
svn revert <file> == git checkout <file>