You are on page 1of 2

#Commiting changes

git status
git diff
ls
cd test
ls
git add committed.js
git diff --staged
git log --pretty=format:"%h %an %ar-%s"
git show

----------------------------------------

#Rebase Conflict

git clone .assessment/remote


cd remote
vi check_number.py
#(press i then make the file as below)
num = 4
if (num % 2) == 0:
print("{0} is Even".format(num))
else: print("{0} is Odd".format(num))
#(Then press esc and type :wq)
git add check_number.py
git commit -m 'modified'
cd ..
bash .fetch_sh
cd remote
git diff master origin/master
#(:wq)
git pull --rebase origin master
vi check_number.py
#(press i and make the file as below)
num = int(input("Enter a number: "))
if (num % 2) == 0:
print("{0} is Even".format(num))
else: print("{0} is Odd".format(num))
#(press esc and type :wq)
git add check_number.py
git rebase --continue
git push origin master

-------------------------------------------

#Undo Changes

cd test
vi hello.py
#(press i then make file as below)
print("Hello world")
#(then press es and type :wq)
git add hello.py
git commit --amend
#(type :wq)
vi hello.py
#(press i)
print("Hello world")
Adding bug tofile
#(press esc and type :wq)
git checkout --hello.py
vi hello.py
#(press esc and type :wq)
git add hello.py
git reset hello.py
git add hello.py
git reset --hard
vi hello.py
#(press i and make)
print("Hello world")
print("Added bug to script")
#(press esc and type :wq)
git add hello.py
git commit -m 'changed hello.py'
git reset HEAD~1
git commit -am "commit to revert"
git revert HEAD
git revert HEAD...HEAD~3 --no-edit

You might also like