Git Tracking, cloning, status, ignoring, showing changes basic commands | git tutorials
Git Tracking files
$ git statusThe 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 initThis 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 logThis 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 diffThis git diff command compares the working directory to the staging area.
$ git diff --stagedThis 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 .gitremove .git
$ git logshow all commit history
$ git log -pshow remove files
$ git log -p -2show two days changes
$ git log --statcommite history in short
$ git log --pretty=onelineshow all commit in oneline
$ git log --pretty=shortshow all commit in short
$ git log --pretty=fullshow all commit in full infomation.
$ git log --since=2daysbefore two days changes
$ git log --since=2weeksbefore two weeks changes
$ git log --since=2monthsbefore two months changes
$ git log --since=2yearsbefore 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 -fall files restore
Post a Comment