Git Tracking, cloning, status, ignoring, showing changes basic commands | git tutorials

 Git Tracking files 

$ git status
    The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which are not, and which files are not being tracked by Git. The status output does not show you any information related to the committed project history.
$ git init
     This git init command help to create a new empty repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository.
$ git add --a
$ git add <filename>
     This command used to add file contents in Staging Area. This command updates the current content of the working tree to the staging area.
$ git commit -m "initial Commit"
      This command used to takes the staged snapshot and commits it to the project history.
$ git log
This command helps the utility tool to review and read the history of everything that happens in the repository.



Cloning a Remote Git Repository from Github
$ git clone <path>
This command helps cloning or copying the target repository and saving it to your local storage.
pwd      //it shows your present working directory
ls      //dir 


Ignoring Files in Git
$ git touch <filename>
This command help to creating new empty file in this repository.
$ git touch .gitignore
(.gitignore) is used to ignore file Add samples of the names of the files you want to ignore and the files will be ignored automatically
rm -rf <dir>
The git rm -rf .git command removes a file or group of files from a Git repository. 



Git Diff:
$ git diff
This git diff command compares the working directory to the staging area.
$ git diff --staged
This git diff --staged command compares the previous commite to the staging area. 



Git: Skipping Staging Area
$ git commit -a -m "direct commit"
Stage all tracked files and commit them. 



Git: Moving and Renaming Files

$ git commit -m "enter commite"
creating commit
$ git rm <filename>
This command helps to removing and staging file in working directory.
$ git mv <filename>
This command helps to rename and staging file in working directory.
$ git rm --chacked <filename>
stop traking 



Git log: Viewing and changing commits

rm -rf .git
remove .git
$ git log 
show all commit history
$ git log -p
show remove files
$ git log -p -2
show two days changes
$ git log --stat
commite history in short
$ git log --pretty=oneline
show all commit in oneline
$ git log --pretty=short
show all commit in short
$ git log --pretty=full
show all commit in full infomation.
$ git log --since=2days
before two days changes
$ git log --since=2weeks
before two weeks changes
$ git log --since=2months
before two months changes
$ git log --since=2years
before two years changes


Unstaging and Unmodifying files

$ git restore --staged <filename>
This command make unstage file
$ git checkout --<filename>
this help to restore from previous file means unmodified
$ git checkout -f
all files restore