Thursday, 29 August 2019

Deleting files in Git by Raj Gupta


Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ ls
Dockerfile  pom.xml  README.md  server/  start2.txt  webapp/

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ vi raj90.txt

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git ststus
git: 'ststus' is not a git command. See 'git --help'.

The most similar command is
        status

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        raj90.txt

nothing added to commit but untracked files present (use "git add" to track)

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git add raj90.txt

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   raj90.txt


Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git rm raj90.txt
error: the following file has changes staged in the index:
    raj90.txt
(use --cached to keep the file, or -f to force removal)

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ ls
Dockerfile  pom.xml  raj90.txt  README.md  server/  start2.txt  webapp/

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   raj90.txt


Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git commit raj90.txt -m "test"
[master 2678aa7] test
 1 file changed, 1 insertion(+)
 create mode 100644 raj90.txt

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git rm raj90.txt
rm 'raj90.txt'

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        deleted:    raj90.txt


Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git commit -m "Deleting new file"
[master 805a6ac] Deleting new file
 1 file changed, 1 deletion(-)
 delete mode 100644 raj90.txt

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (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-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ ls
Dockerfile  pom.xml  README.md  server/  start2.txt  webapp/

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git rm stsrt2.txt
fatal: pathspec 'stsrt2.txt' did not match any files

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git rm start2.txt
rm 'start2.txt'

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (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)
        deleted:    start2.txt


Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ ls
Dockerfile  pom.xml  README.md  server/  webapp/

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git reset HEAD start2.txt
Unstaged changes after reset:
D       start2.txt

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ ls
Dockerfile  pom.xml  README.md  server/  webapp/

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (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/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    start2.txt

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

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ git checkout -- start2.txt

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (master)
$ ls
Dockerfile  pom.xml  README.md  server/  start2.txt  webapp/

Administrator@EC2AMAZ-8EUJ4RB MINGW64 ~/projects/hello-world (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

Adm

1 comment:

  1. Raj Gupta_Aws Cloud Engineer: Deleting Files In Git By Raj Gupta >>>>> Download Now

    >>>>> Download Full

    Raj Gupta_Aws Cloud Engineer: Deleting Files In Git By Raj Gupta >>>>> Download LINK

    >>>>> Download Now

    Raj Gupta_Aws Cloud Engineer: Deleting Files In Git By Raj Gupta >>>>> Download Full

    >>>>> Download LINK I6

    ReplyDelete