Git版本控制(Version Control)

2017-11-10  本文已影响0人  蕉下客_fc5b

download link: https://git-scm.com/downloads
tutorial link: https://www.atlassian.com/git/tutorials

Initializing a new repository: git init

git init : create a new .git subdirectory in your current working directory. This will create a master branch.

Cloning an existing repository: git clone

create a copy or clone of remote repositories.

Saving changes to the repository: git add and git commit

The git add command adds a change to the staging area. However, git add doesn't actually recorded until you run git commit.

Git stash

Git stash temporarily saves your changes you've made to your working copy so you can work on something else.
Re-applying your stashed changes : git stash pop
Stashing untracked or ignored files*
By default, running git stash will stash

But it will not stash:

.gitignore

Git sees every file in your working copy as one of three things:

Syncing

git remote / git fetch / git pull / git push

cheat sheet
git status : check current branch and status
git add . : stage all changes
git commit : commit changes
git commit --amend : make changes for last commit and change this commit
git checkout branchName : switch to a branch
git checkout -b newBranchName: create a new branch
git log : check log
git lg : show branches table

git push origin branchName : push your branch to remote
git push origin branchName --force : force update your remote branch

git remote -v : checkout your upstream
git branch -a : show all branches

To be continued...

上一篇下一篇

猜你喜欢

热点阅读