Learn GIT
来源:互联网 发布:21天学通c语言电子版 编辑:程序博客网 时间:2024/04/30 12:33
Git是目前世界上最先进的分布式版本控制系统。
一、Git Workflow
1.git init:creates a new Git repository
2.git status:inspects the contents of the working directory and staging area
3.git add:adds files from the working directory to the staging area
4.git diff:shows the different between the working directory and the staging area
5.git commit:permanently stores file changes from the staging area in the repository
6.git log:shows a list of all previous commits
二、3 different ways to backtrack
1.git checkout HEAD filename:Discards changes in the working directory.
2.git reset HEAD filename:Unstages file changes in the staging area.
3.git reset SHA:Can be used to reset to a previous commit in your commit history.
三、Git Branching
1.git branch:Lists all a Git project’s branches
2.git branch branch_name:Creates a new branch
3.git checkout branch_name:Used to switch from one branch to another
4.git merge branch_name:Used to join file changes from one branch to another
5.git branch -d branch_name:Deletes the branch specified
四、Git Teamwork
1.git clone:Creates a local copy of a remote
2.git remote -v:Lists a Git project’s remote
3.git fetch:Fetches work from the remote into the local copy.
4.git merge origin/master:Merges origin/master into your local branch.
5.git push origin :Pushes a local branch to the origin remote.
Git projects are usually managed on Github, a website that hosts Git projects for millions of users. With Github you can access your projects from anywhere in the world by using the basic workflow you learned here.
PS:
1.怎么将本地文件上传到github?
- github上创建一个资源
- 切换到你本地目录下
- git init
- git remote add origin xxxx.git //xxx.git就是你在远程github上创建资源http地址
- git add .
- git commit -m ‘add’
- git push origin master
- finish
2.如何用git创立自己的项目?
Step 1: Create the README file
In the prompt, type the following code:mkdir ~/Hello-World# Creates a directory for your project called "Hello-World" in your user directorycd ~/Hello-World# Changes the current working directory to your newly created directorygit init# Sets up the necessary Git files# Initialized empty Git repository in /Users/you/Hello-World/.git/touch README# Creates a file called "README" in your Hello-World directory
Step 2: Commit your README
git add README
# Stages your README file, adding it to the list of files to be committed
git commit -m 'first commit'# Commits your files, adding the message "first commit"
Step 3: Push your commit
git remote add origin https://github.com/username/Hello-World.git
# Creates a remote named "origin" pointing at your GitHub repositorygit push origin master# Sends your commits in the "master" branch to GitHub
- Learn GIT
- git learn
- My learn of git
- git learn (1)
- Udacity learn git
- Learn git from code school
- Learn git with bitbucket-cloud
- How To Learn Git (Git基础教程)
- 【整理】【Learn Git Branching】01 基础篇
- 【整理】【Learn Git Branching】02 高级篇
- learn
- learn
- Sharing with Git,Learn how to use Git to share your Xcode projects
- Git及Github(Odoo代码所在平台)官方入门教程翻译:Learn Git and GitHub without
- Learn Chinese ,Learn English!
- learn how to learn
- learn how to learn
- To Learn
- 对于ztree的使用详解
- MFC对话框整合
- Linux中ifreq 结构体分析和使用(转)
- 矩阵链乘问题
- Maven学习 (四) 使用Nexus搭建Maven私服
- Learn GIT
- 冒泡排序
- LeetCode 453. Minimum Moves to Equal Array Elements
- 浅析Html5 data-*自定义属性
- eclipse将控制台日志打印到日志文件
- 封装
- android有哪些具体的情形会导致内存泄漏
- linux学习
- VR系列——Oculus Audio sdk文档:四、传统Oculus声场定位技术的统一集成指南(4)——如何在Unity中使用Oculus声场定位技术