Git - Essentials
some basic git commands
branch
# move to a branch
git checkout <branch_name>
# create and move to a new branch
git checkout -b <branch_name>
# delete a branch
git branch -d <branch_name>
# rename a branch
git branch -m <renamed_branch>
add
add changed files
# add all changed files
git add --all
# add a file
git 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 remote
git push
# push a branch which doesn't exist on remote yet
git push -u <upstream> <branch_name>
status
git status
configurations
# read configured user in current repo
git config user.name
git config user.email
# read configured global user
git config --global user.name
git config --global user.email
# configure user in current repo
git config user.name "your_name"
git config user.email "your_email"
# configure global user
git config --global user.name "your_name"
git config --global user.email "your_email"
initialize a git repo
git init