Skip to content

thebrownbox/HowToUseGit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 

Repository files navigation

Basic git commands

Checkout: http://www.hoangvancong.com/category/software-development/tools/git/

First command

Setting username and email

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

Save username and password

git config --global credential.helper store
git pull

Get personal tocken for password:

https://github.com/settings/tokens

Local commands

1. Initialize a new LOCAL git repository

git init [Init in CURRENT FOLDER]
git init NEW_FOLDER[Init in NEW FOLDER]

2. Add a UNTRACKED_FILE or MODIFIED_FILE to staging area

git add FILE_NAME
git add . [Add a all changes in CURRENT_FOLDER to staging area]

3. Check current status

git status

4. Commit files in staging area

git commit -m "your_message"
git commit -am "your_message"[Do both "add" command and "commit" command at the same time]

5. Show log

git log
git log --oneline[More offen]
log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit [Most Offen]
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"[With this config you only have to type "git lg"]

Social commands

NOTE: COMMIT -> PULL -> MERGE or FIX Conflict if needed -> PUSH

1. Clone new project

git clone https://github.com/thebrownbox/HowToUseGit.git

2. Checkout an exist branch

git checkout exist_branch

3. Create and Checkout a new branch

git checkout -b new_branch

Push local branch to remote

git push -u origin new_branch

4. Push commited chages to remote

git push

5. Merge branch other_branch into current branch

git merge other_branch

NEW

command[NOTE]

About

Testing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •