-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitcommands
31 lines (25 loc) · 1.24 KB
/
gitcommands
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
#in Jupyter Notebook, create a New Terminal
mkdir myrepo
cd myrepo
git init #initialize a .git folder containing all the git files
ls -la .git #show a list of files in the .git folder
touch newfile #create a new file
git add newfile #add the newfile to the repo
git config --global user.email "[email protected]" #log into github
git config --global user.name "Your Name"
git commit -m "added newfile" # commit change
git branch my1stbranch #create a branch
git branch #check out the branches
git checkout my1stbranch
git checkout -b my2ndbranch #another way to create a branch
echo "Here is some text in my new file" >> newfile #make changes in file
cat newfile #verify if text has been added
git status #check file status
git add * #get file ready to commit
git commit -m "add readme.md and modified newfile" #commit changes
git log #see history of recent commits
git revert HEAD --no--edit #use the shortcut HEAD to rollback the last commit
#press Q to exit git log
git checkout master #merge my1stbranch to master
git merge my1stbranch
git branch -d my1stbranch #delete my1stbranch