Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.19 KB

How-to-begin.md

File metadata and controls

36 lines (27 loc) · 1.19 KB

Initalising an empty git repository

git init

Checking status of git repository

git status

Adding files

To add all untracked files: git add .
To add a specific file: git add fileName.txt

Removing files

git rm file.txt
To remove directories, git rm -r dirName

To record all removals, additions, and modifications in the working tree use: git add -A

Commit files

  • Giving a commit message: git commit -m "Meaningful commit message"

  • Adding more files to the last commit (no change in commit message):
    git add file.txt
    git commit --amend --no-edit

    In case commit message has to be changed too, git commit --amend suffices the purpose.

    Note : To push it now, you need to use the force command (Careful!)
    git push origin master --force

Configure the author name and email address to be used with your commits

git config --global user.name "xyz"
git config --global user.email [email protected]

View all the file diff

git diff

Checking the commits history

git log

  • Summary parameter will show information such as creations, renames and mode changes: git log --summary