-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_commands.txt
More file actions
55 lines (40 loc) · 1.45 KB
/
git_commands.txt
File metadata and controls
55 lines (40 loc) · 1.45 KB
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
# for .gitignore
# to exclude all svn files - .svn (no wildcards or /)
# to exclude all DW notes directories and files - _notes (no wildcards or /)
# to remove a file that is tracked from being tracked
git rm --cached <filename>
#to discard all current changes and revert to last commit
git checkout .
# clone into current directory
# directory must be empty
git clone git@github.com:user/my-project.git .
#force a push to the remote
git push -f <remote> <branch>
#Set user name and email
git config --global user.name "Shelane French"
git config --global user.email "french8@llnl.gov"
#Read user name and email
git config user.name
git config user.email
#List all global config
git config --list
#Config file location
~/.gitconfig
# Create orphan branch
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
git push origin orphan_name
#Inside the .git folder for your project, there is a file /info/exclude.
#This file has the exact same structure as a .gitignore file,
#so you can add the file patterns for any files which must be excluded locally, inside that file.
# List commits from one branch to another
git log branch1...branch2 --oneline --reverse --pretty="format:%s
# Create patch:
# Have both files in the same directory
# from within that directory in terminal issue command
diff -u originalfile.ext newfile.ext > patchfilename.patch
# Apply patch:
# Have patch file within directory
patch -p1 <patchfilename.patch