Skip to content

anandrkskd/GIT-Notes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Getting started with Git / Github

Important Links & Commands to get you started with GIT

Debian (Ubuntu)

sudo apt-get update - update dependencies of Ubuntu

sudo apt-get install git - install git

RPM (Redhat, Fedora)

yum install git - install git

Windows

Download Git Bash from GitForWindows

Setting up a repository

Cloning an existing Git repo -

  • git clone <url_of_your_remote_repository>,

    e.g. git clone https://github.com/CodeDocsJECRC/society

Configuring Git repo for remote collaboration -

  • git config --global user.name <user_name> - configure user name for that repository,

    e.g. git config --global user.name ShivSoni5

  • git config --global user.email <user_email> - configure user email for that repository,

    e.g. git config --global user.email shivsonic05@gmail.com

  • git config --list - list the configured details

Initializing a Git repository for a new or existing project -

  • git init - Initialize the current directory as git directory

  • git remote add <remote_repo_name> <remote_repo_URL>,

    e.g. git remote add origin https://github.com/CodeDocsJECRC/society

  • git add .

  • git commit -m "message"

  • git push -u <remote_repo_name> <branch_name>,

    e.g. git push -u origin master

Common Git version control commands

  • git add <file_name> - File will be tracked

    e.g. git add README.md

  • git commit -m "First Commit" - tracked file will be committed

  • git push origin <branch_name> - pushing commits to server repository,

    e.g. git push origin bug

  • git branch <branch_name> - Creating new branch,

    e.g. git branch bug

  • git checkout <branch_name> - Switch Branch,

    e.g. git checkout bug

  • git checkout -b <branch_name> - Creating and switching to new branch

  • git merge <branch_name> ,

    e.g. git merge bug - merging bug into master branch (present by default)

  • git branch -d branch_name - Deleting a branch,

    e.g. git branch -d bug

  • git log - provides commit ID and history

  • git reset --hard old_ID - Head to any previous commit

  • git diff old_ID new_ID - To view the changes you make in a file

Some useful resources

Documentations and Tutorials

Video Tutorials & Playlists

About

All required git commands.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published