# connect remote repo to the local repo, the remote repo has name origin, followed by its URL git remote add origin git@account_name.git.beanstalkapp.com:/acccount_name/repository_name.git
get the latest version of a repository
1
git pull <branch_name> <remote_URL/remote_name>
Sends local commits to the remote repository
1 2 3 4 5 6 7 8 9 10 11
# push local commits to a remote repo git push <remote_URL/remote_name> <branch>
# push local branch MASTER to remote repo ORIGIN, git push origin master
# push all local branches to remote repo git push -all origin
# -u flag will keep track all pushes so next time you can just use git push git push -u origin master
show the chronological commit history for a repository
1
git log
make a copy to another remote repo
1
git fork
make a copy from a remote repo to the a local repo
1
git clone
Temporarily save local changes before pulling from remote repo (local changes are not ready for commit)
1 2
# stash basically has the same logic as commit, git will just save the changes in different places so it will not appear in your commit history git stash save
Reapply local changes after pulling
1
git stash pop
change the starting poing of a branch
1 2
# this is make the commit history looks cleaner. But will cause problems when working with others because when you do it, your branch's starting poing is different to others and becomes a different branch git rebase
git squash
combine multiple commits into one commit, make the commit history looks cleaner
Maybe you could buy me a cup of coffee.
Scan this qrcode
Open alipay app scan this qrcode, buy me a coffee!
Scan this qrcode
Open wechat app scan this qrcode, buy me a coffee!