天天看點

Version Control with Git (Udacity)優達學城筆記--L1:What is Version Control

version control: control version

version cotrol systems: git, subversion, mercurial

centralized:all users connect to a central, master repository

distributed: each user has the entire repository on their computer

git: distributed version control system

git: version control tool

github: service that hosts git projects

version control system(vcs) is a tool that manages different versions of source code.

source code manager(scm) is another name for a version control system.

<a href="https://git-scm.com">git</a>

commit save the state of your project in git

repository(repo) is a directory which contains your project work, as well as a few files which are used to communicate with git.repositories can exit either locally on your computer or as remote copy on another computer. a repository is made up of commits.

working directory is the files that you see in your computer's file system. when you open your project files up on a code editor, you're working with files in the working directory. this is in contrast to the files that have been saved(in commits!) in the repository. when working with git, the working directory is also different from the command line's concept of the current working directory which is the directory that your shell is "looking at" right now.

checkout is when content in the repository has been copied to the working directory.

staging area/staging index/index a file in the git directory that stores information about what will go into your next commit.

sha is basically an id number for each commit. it is a 40-character string composed of characters(0-9 and a-f) and calculated based on the contents of a file or directory structure in git. secure hash algorithm.

branch is when a new line of development is created that diverges from the main line of development.

usage:git [--version] [--help] [-c ] [-c name=value] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-pl--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] []

the most commonly used git commands are:

add add file contents to the index

bisect find by binary search the change that introduced a bug

branch list,create,or delete branches

checkout checkout a branch or paths to the working tree

clone clone a repository into a new directory

commint record changes to the repository

diff show changes to the repository

fetch download objects and refs from another repository

grep print lines matching a pattern

init create an empty git repository or reinitialize an existing one

log show commit logs

merge join two or more development histories together

mv move or rename a file, a directory, or a symlink

pull fetch from and integrate with another repository or a local branch

push update remote refs along with associated objects

rebase forward-port local commits to the updated upstream head

reset reset current head to the specified state

rm remove files from the working tree and from the index

show show various types of objects

status show the working tree status

tag create, list, delete or verify a tag object signed with gpg

'git help -a' and 'git help -g' lists available subcommands and some concept guides. see 'git help ' or 'git help ' to read about a specific subcommand or concept.

configuration steps

first time git configuration

associate x text editor with git

atom editor setup

sublime text setup

vscode setup