Git – Command – “git reset”

Background

A few posts ago we touched on a couple of git commands.

Let us talk about git reset.

Thankfully, rarely use it.

Lineage

Here are relevant preceding posts:-

  1. Git – Client – Commands
    Link

 

Scenario

Here is what led to this post.

I created a couple of files.

But, did not like the folder that I created the files under.

Structurally, it made more sense to place the file in a new separate folder.

 

Outline

  1. Show Current Status
    • git status
  2. Rollback Local Git Changes
    • git reset
  3. Show Current Status ( Post Git Reset )
    • git status
  4. Move Files
    • Use File System file move commands
    • In Linux
      • Use mv
  5. Add Files referencing the new location
    • git add
  6. Show Current Status ( Post Git Add )
    • git status
  7. Re-Commit Changes
    • git commit
  8. Upload Changes ( Upload local repository content to a remote repository )
    • git push

Tasks

Show Current Changes

git status

Syntax


git status

Sample


git status

Output

Output – Image

 

git reset

Syntax


git reset

Sample


git reset

Output

Output – Image

 

git status – “Post Git Reset”

Syntax


git status

Sample


git status

Output

Output – Image

 

Move Files

Linux

mv

Syntax

mv <filename> <folder-destination>

Sample


mv person.sql model

git add

Syntax


git add <filename>

Sample


git add model\person.sql

git status – “Post Git Add”

Syntax


git status

Sample


git status

Output

Output – Image

git commit

Syntax


git commit

Sample


git commit

 

git push

Syntax


git push

Sample


git push

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s