Skip to content

just-basic/git-basic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 

Repository files navigation

git-basic

README.md files

Instruction Documentation.

Commands

Repositody

  • git init Initialize a new Git repositody

  • git cone <repo-url> Clone a Repo from URL

Basic

  • git status Show changes status
  • git add Add changes to Staging
  • git commit -m "Commit message" Commit changes with a message
  • git log View commit history

Branching

  • git branch List of branches
  • git branch <branch name> create a new branch
  • git checkout <branch name> Switch to branch
  • git merge <branch-name> Merge changes from a branch
  • git branch -d <branch name>

Remote repositories

  • git remote List of remotes
  • git remote add <name> <url> add a remote
  • git push <remote> <branch> push changes to a remote
  • git pull <remote> <branch> Pull changes form a remote

Unduing changes

  • git pull fetch and merge changes
  • git fetch fetch changes without merging
  • git reset --hard HEAD Discard changes
  • git revert <commit-hash> Revert changes in a commit

To check current credentials:

git config --global user.name  
git config --global user.email

To set global level credentials:

git config --global user.name <name>  
git config --global user.email <your-email>

To set repo level credentials:

git config user.name <name>  
git config user.email <your-email>

..or create a new repository on the command line
git init
git add README.md
git commit -m "Commit message"
git branch -M main
git remote add origin <rep link>
git push -u origin main

...or push an existing repository from the command line
git remote add origin <rep link>
git branch -M main
git push -u origin main

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published