git- code management tool

  1. What is GIT

git is a distributed open source version control system, for efficient management of projects and documents of various sizes.

  1. Use code management tools
  • Prevent the code is lost, do a backup
  • Version management and control of the project, you can jump by setting node
  • Establish their own development environment branch, independently of each other, to facilitate the merger
  • When the development of multi-terminal, transmitting a code to facilitate mutual
  1. git features
  • git is open source, multi-use under * nix, you can manage files
  • git is distributed project management tools (svn is centralized)
  • git data management and more diverse, fast sharing speed, data security
  • git branch have better support, facilitate coordination multiplayer
  1. git installation

sudo apt-get install git

GIT use

basic concept

  • Workspace: the directory where the project operation, the actual operation of the project area
  • Staging area: a work record workspace (modified) content
  • Warehouse District: backup workspace for content
  • Remote repository: GIT repository on a remote host

Note: In the local repository, git always want the contents of the work area and warehouse district consistent, and only the contents of the warehouse district and the other in order to interact with remote repositories.

Initial Configuration

Configuration command: git config

  • Configure all users: git config --system [Options]

Profile location: / etc / gitconfig

  • Configure the current user: git config --global [Options]

Configuration file location: ~ / .gitconfig

  • Configuring the current project: git config [option]

Profile Location: project / .git / config

  1. Configuring user name
e.g. 将用户名设置为Tedu
sudo git config --system user.name Tedu
  1. Configure the user's mailbox
e.g. 将邮箱设置为[email protected]
git config --global user.email [email protected]
  1. Configuration compiler
e.g. 配置编译器为pycharm
git config core.editor pycharm

  1. View configuration information
git config --list

Basic Commands

  1. Initialization warehouse

git init
significance: the operation of a project directory into a git directory, generate local git repository. That is, the project can use git directory management

  1. Check local warehouse status

git status
Note: After initialization warehouse work in the master branch by default, when a workspace is inconsistent with the warehouse district will be prompt.

  1. The work content recorded to the staging area

git add [files..]

e.g. 将 a ,b 记录到暂存区
git add  a b

e.g. 将所有文件(不包含隐藏文件)记录到暂存区
git add  *
  1. Cancel the temporary file records

git rm --cached [file]

  1. Sync files to a local warehouse

git commit [file] -m [message ]
Description: -m represents the synchronization information to add some expression Syndicate content

e.g.  将暂存区所有记录同步到仓库区
git commit  -m 'add files'
  1. View commit log record

git log
git log --pretty=oneline

  1. Compare workspace file and warehouses file differences

git diff [file]

  1. The recovery staging area or a certain point commit files to the workspace

git checkout [commit] -- [file]

  • - for preventing misoperation, checkout there handover branch
  1. Move or delete files

mv git [File] [path]
git RM [Files]
Note: These two operations modify the contents of the work area while operating records submitted to the staging area.


@ Expand and extend

In Git project by way of a folder of the project definition file .gitignore, the provisions of the corresponding ignore rules that manage the files in the current folder of the Git commit behavior. .gitignore file can be submitted to a public warehouse, which for all developers in the project are ignored share a set of defined rules. In .gitingore file, follow the appropriate syntax, to specify a rule ignored on each line.

.gitignore忽略规则简单说明

file            表示忽略file文件
*.a             表示忽略所有 .a 结尾的文件
!lib.a          表示但lib.a除外
build/          表示忽略 build/目录下的所有文件,过滤整个build文件夹;


version control

  1. Return to the previous commit node

git reset --hard HEAD ^
Note: A ^ represents a fallback version, and so on. When the version rollback workspace will automatically commit current and consistent version

  1. Return to the specified node commit_id

git reset --hard [commit_id]

  1. View all operational records

git reflog
Note: The top of the latest recording, you can take advantage of commit_id go any operating position

  1. Create Label

Tags: add in important positions commit a snapshot of the project, saving time work, generally used for iterative version.

git tag [tag_name] [commit_id] -m [message]
Description: commit_id can not write the default label indicates the latest commit_id location, message can not write, but it is best to add.

e.g. 在最新的commit处添加标签v1.0
git tag v1.0 -m '版本1'
  1. Look at the label

git tag to see a list of labels
git show [tag_name] View tag details

  1. Destined for a node label

git reset --hard [tag]

  1. Remove label

git tag -d [tag]

Save Workspace

  1. Save Workspace content

git stash save [message]
Note: The modified workspace uncommitted sealed, so that the work area back to the previous state

  1. View the list of workspaces

git stash list
Description: The latest saved workspace at the top

  1. Application of a workspace

git stash apply [stash@{n}]

  1. Delete Workspace

git stash drop [stash @ {n }] delete a workspace
git stash clear deletes all saved workspace

Branch Management

Definition: the branch that every person based on legacy code (branch) on their work environment, developed separately without disturbing each other. After the completion of the development work carried out unified branch merge.

  1. View bifurcation

git branch
Note: * indicates a branch preceded the current working branch

  1. Creating a branch

git branch [branch_name]
Description: Creating a branch based on the branch b, b branch at this time will have the entire contents of a branch. When you create a b branch is best to keep a branch of "clean" state.

  1. Switching Operation Branch

git checkout [branch]
Description: 2,3 may be operated simultaneously, and branch switching is created

git checkout -b [branch_name]

  1. Merge branch

git merge [branch]

Conflict is merging branches during the most difficult issues

When the branches merge, the original branch and the former conflict will change
to add a new module (file) when merging branches, such conflicts can be resolved automatically, simply decide to commit operation.
When the two branches merging branches modify the same file, you need to manually resolve the conflict.

  1. Deleted branches

git branch -d [branch] Delete branch
git branch -D [branch] Delete not merged branches

Branches merge

Remote repository

git repository on the remote host. Git is actually distributed structure, similar to each host git repository structure, just git repository on someone else host is called a remote repository.

GitHub Introduction

github project is an open source community site, with the world's most open source projects. Developers can register for the site to build their own warehouse project in github.

URL:  github.com

Code Management Tools: git

Get an item

  • In the upper left corner of the project to obtain the desired search bar search

  • After selecting Project Copy Project git address

  • We can get used locally git clone method
git clone https://github.com/xxxxxxxxx

Note: Get to the local project will automatically establish a connection and remote github repository. And acquired the project itself is also a git project.

Create a git repository

  • Top right, click the plus sign drop-down menu, select a new warehouse

  • Fill in the appropriate information to the project

  • github repository relatively local host is connected to a remote repository via remote, if a password is required to enter a password github. You can use a remote warehouse operations command operation after connection. readme file is automatically introduced as a project

  • If you are around the corner of a warehouse in the warehouse selected settings interface, you can choose to delete the last warehouse


Remote warehouse operations command

All operations carried out under local git repository

  1. Adding a remote repository
git remote  add origin https://github.com/xxxxxxxxx
  1. Delete the remote host

git remote rm [origin]

  1. View host connections

git remote
Note: The remote host name connected to a git project will not be repeated

  1. The local branch pushed to the remote repository
将master分支推送给origin主机远程仓库,第一次推送分支使用-u表示与远程对应分支建立自动关联
git push -u origin  master
  1. Delete remote branch

git branch -a view all branch
git push origin [: branch] delete remote branch

  1. Other push method

git push --force origin for the local version of the push to force the local version than the remote version of the old

git push origin [tag] push tab to the remote local

git push origin --tags push local labels to all remote

git push origin --delete tag [tagname] Delete a remote repository tags

  1. Get the code from the remote

git pull

The remote master pulled to the local branch, a branch tmp
git fetch origin master: tmp

the difference

pull pulling remote content directly to the local content and corresponding merging branch
fetch the remote to the local branch pulled content, but does not correspond to the local branch, and combined, based on their combined merge before use.

Software development process

需求分析 ----》 概要设计  ---》 项目计划 ----》详细设计---》编码测试 -----》项目测试 ----》调试修改 ---》项目发布----》后期维护

Needs analysis: determine the real needs of users

  1. The basic function of determining the real needs of users, projects
  2. And the overall difficulty of analysis to determine the feasibility of the project
  3. Needs analysis documents, the user confirms

Summary of design: a preliminary analysis of the project and the overall design

  1. Determining function module
  2. Feasibility analysis to build the overall architecture diagram
  3. Determine the technical ideas and use framework
  4. Forming a summary document to guide the development process

Project Plan: Determine project development timeline and process

  1. Determine the sequence of development work
  2. Determine the timeline, event milestone
  3. Personnel division
  4. An auxiliary content Gantt and the like mind map

Detailed design: specific project realization

1. The detailed design document form: thinking, logic flow, functional description, technical point instructions, data structures, codes described

Encoding test: write code to achieve According to the schedule, and do basic test

  1. Coding
  2. Write test procedures
  3. Technology research

Test Project: The project tested according to function

  1. Cross-platform testing, using test
  2. Code changes according to the test report
  3. Complete test report

Project Releases

1. Project Delivery users to publish
2. The preparation of project documentation

post-maintenance

1. To maintain the normal operation of the project
iteration 2. upgrade project

Project Considerations

  • The conflict between the lack of timely completion of project work and project time
  • The conflict between the project staff

Use project tools

Documenting: word ppt excel markdown LaTex
project flow chart: Mindmanager visio
project management: project
code management: svn git

E-dictionary

Reference Code: dict

Function Description

Users can log on and register
* Log in with a user name and password to login
* Registration requires users to fill in a user name, password, and other custom content
* username requirements can not be repeated
* require the user information can be stored for a long

You can enter to prompt the client through the basic graphical interface print.
* The program is divided into server and client in two parts
* client input commands initiated by the print request to print a simple interface
primarily responsible for server-side logic * data processing
* After starting the server should be able to meet a number of clients operating

The client after boot into one interface, includes the following functions: Sign Out

* Quit to exit the software after 
* successful login into the secondary interface that is, fail back to the previous interface 
* successful registration may continue to log back to the previous screen, you can also enter the secondary interface directly with registered users

After the user logs into the secondary interface, the following functions: search word history log off

* Select the write-off return to the previous screen 
* look up the words: circulation type the word, get the word interpretation, special symbols input word quit query the status 
* History: query the current record the user's search term, requires records contain name word time. You can view all of the records or before 10 available.

This word description

Each word must row for
word in ascending order
between words and explain certain spaces

Search word description

Direct use of this word queries (text manipulation)
first words stored in the database, then the database query. (Database operations)

HTTPServer

Reference Code: HTTPServer

Features:

httpserver part

Get http request
parsing http request
to send the request to WebFrame
receiving feedback data from WebFrame
organizes data is sent to the client Response Format

WebFrame part

Receiving a request from a httpserver specific
logic processing and data processing according to the request
data needs to feedback httpserver

Feature

Httpserver uses and applications processing mode of separation, the degree of coupling is reduced
using a user profile idea
webframe part is a processing method for simulating a rear end of the frame

Technical points

httpserver required to establish communication with both end portions
webFrame multiplexer part is received concurrent requests
data transfer format using json

Project structure:

           |--httpserver --HttpServer.py (主程序)      
           |             --config (httpserver配置)   
  project--|
           |
           |
           |--WebFrame   --WebFrame.py (主程序代码)
                         --static (存放静态网页)
                         --views.py ( 应用处理程序) 
                         --urls.py (存放路由)
                         --settings (框架配置)

Interactive data format protocols

httpserver--》webframe  {method:'GET',info:'/'}

webframe-->httpserver {status:'200',data:'ccccc'}

 

Guess you like

Origin www.cnblogs.com/gyl10/p/11121164.html