Git - Essentials
some basic git commands
branch
# move to a branchgit checkout <branch_name># create and move to a new branchgit checkout -b <branch_name># delete a branchgit branch -d <branch_name># rename a branchgit branch -m <renamed_branch>
add
add changed files
# add all changed filesgit add --all# add a filegit add <file_relative_path>
references: rubygarage
commit
commit changes
git commit -m "your_commit_message"
push
push changes to remote repository
# push a branch which already connected and exist in remotegit push# push a branch which doesn't exist on remote yetgit push -u <upstream> <branch_name>
status
git status
configurations
# read configured user in current repogit config user.namegit config user.email# read configured global usergit config --global user.namegit config --global user.email# configure user in current repogit config user.name "your_name"git config user.email "your_email"# configure global usergit config --global user.name "your_name"git config --global user.email "your_email"
initialize a git repo
git init