Tuesday, 27 August 2019

Backing out changes in Git by Raj Gupta


Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer (master)
$ ls
'How to choose an AMI by Root Device Type'            'How to Install phpMyAdmin on LAMP server'                        'How to Secure the LAMP Server Database'   README.md
'How to host a WordPress Blog with in Amazon Linux'   'How to resolve InstanceLimitExceeded error of EC2 server'         level1/
'How to Install a LAMP Web Server on Amazon Linux 2'  'How to retrieve the System Logs of our EC2 Server by Raj Gupta'   raj.txt

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer (master)
$ cd level1/

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ ls
level2/  raj1.test

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ vi raj1.test

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   raj1.test

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ ls
level2/  raj1.test

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ git add raj1.test

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
  (use "git push" to publish your local commits)

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   raj1.test


Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ git reset HEAD raj1.test
Unstaged changes after reset:
M       level1/raj1.test

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   raj1.test

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ git checkout -- raj1.test

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

Administrator@EC2AMAZ-H8K4U2K MINGW64 ~/projects/Amazon-Web-Services-AWS-Cloud-Engineer/level1 (master)
$

No comments:

Post a Comment