惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
F
Fortinet All Blogs
B
Blog
GbyAI
GbyAI
P
Proofpoint News Feed
量子位
The Register - Security
The Register - Security
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
B
Blog RSS Feed
WordPress大学
WordPress大学
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
V
Vulnerabilities – Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
雷峰网
雷峰网
Stack Overflow Blog
Stack Overflow Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Webroot Blog
Webroot Blog
AWS News Blog
AWS News Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
O
OpenAI News
月光博客
月光博客
H
Hacker News: Front Page
S
Security Affairs
W
WeLiveSecurity
The Hacker News
The Hacker News
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Help Net Security
Help Net Security
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
T
The Blog of Author Tim Ferriss
Spread Privacy
Spread Privacy
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
S
Securelist
Microsoft Azure Blog
Microsoft Azure Blog
TaoSecurity Blog
TaoSecurity Blog
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
A
About on SuperTechFans

博客园 - Mark Jiao

调试Java程序持续占cpu问题 Freemarker notes | Freemarker学习笔记 Spring Struts Hibernate trouble shooting | 一些问题的记载 MySQL 性能调优之查询优化 Tomcat性能调优 | Tomcat Performance Tuning Tomcat配置、管理和问题解决 | Tomcat Configuration, Manangement and Trouble Shooting SWT Browser & XULRunner Windows应用安装制作工具调查报告 CentOS Configuration | CentOS配置 命令行加载IE ActiveX插件 Java那些事儿 互联网技术要考虑的事情 Parameterized Testing | 参数化测试 Introduce products I worked on | 介绍一下我做过的产品 PHPUnit manual note | PHPUnit手册笔记 PHP manual notes | PHP手册笔记 Globalization, Localization, Internationalization and Translation HTTP 超文本传输协议 Design Patter
Git usage | Git 使用
Mark Jiao · 2014-04-22 · via 博客园 - Mark Jiao

Git Help:

[root@vm429.dev unit]# git help

usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]

           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]

           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]

           [-c name=value] [--help]

           <command> [<args>]

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

   commit     Record changes to the repository

   diff       Show changes between commits, commit and working tree, etc

   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 merge 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   tag        Create, list, delete or verify a tag object signed with GPG

提交、上传

git commit 提交到本地。

git push提交到遠程服務器。

在本地仓库里添加一些文件,比如README,

$ git add README

$ git commit -m "first commit"

上传到github:

$ git push origin master

3 Steps to merge local changes:

[root@vm514.dev sitecatalyst]# git help commit

[root@vm514.dev sitecatalyst]# git commit -a

[master 7f01ec7] Fix sitecatalyst test errors and failures. Upgrade tests from PHPUnit 3.4.0 to 3.7.27.

13 files changed, 14 insertions(+), 22 deletions(-)

[root@vm514.dev sitecatalyst]# git push

Counting objects: 47, done.

Compressing objects: 100% (21/21), done.

Writing objects: 100% (24/24), 2.03 KiB, done.

Total 24 (delta 13), reused 0 (delta 0)

To git@git.corp.adobe.com:ligyu/sitecatalyst.git

   316256d..7f01ec7  master -> master

[root@vm514.dev sitecatalyst]# git pull

https://git.corp.adobe.com/ligyu/adminModule click “pull request”.

Fetch commits from remote:

[root@vm82.dev sitecatalyst]# git fetch origin master

remote: Counting objects: 9, done.

remote: Compressing objects: 100% (1/1), done.

remote: Total 5 (delta 4), reused 5 (delta 4)

Unpacking objects: 100% (5/5), done.

From git.corp.adobe.com:AdobeAnalyticsWeb/sitecatalyst

* branch            master     -> FETCH_HEAD

[root@vm82.dev sitecatalyst]# git fetch origin master

From git.corp.adobe.com:AdobeAnalyticsWeb/sitecatalyst

* branch            master     -> FETCH_HEAD

[root@vm82.dev sitecatalyst]# git remote -v

origin  git@git.corp.adobe.com:AdobeAnalyticsWeb/sitecatalyst.git (fetch)

origin  git@git.corp.adobe.com:AdobeAnalyticsWeb/sitecatalyst.git (push)

Revert a file change:

If you have not yet added the changes to the index or committed them, then you just want to use the checkout command - this will change the state of the working copy to match the repository:

                git checkout A

If you added it to the index already, use reset:

                git reset A

If you had committed it, then you use the revert command:

                # the -n means, do not commit the revert yet

                git revert -n <sha1>

                # now make sure we are just going to commit the revert to A

                git reset B

                git commit

Rollback/Reset a Git repository to a particular commit

git reset --hard <tag/branch/commit id>

For example:

$ git reset --hard e6b2d58b3d7dd7cbb6375c76aa036a70d03107f2

Sync a fork

https://help.github.com/articles/syncing-a-fork

[httpd@vm514.dev application_platform]$  git remote rm upstream

[httpd@vm514.dev application_platform]$ git remote add upstream git@git.corp.adobe.com:AdobeAnalyticsWeb/application_platform.git

[httpd@vm514.dev application_platform]$ git remote -v

origin  git@git.corp.adobe.com:ligyu/application_platform.git (fetch)

origin  git@git.corp.adobe.com:ligyu/application_platform.git (push)

upstream        git@git.corp.adobe.com:AdobeAnalyticsWeb/application_platform.git (fetch)

upstream        git@git.corp.adobe.com:AdobeAnalyticsWeb/application_platform.git (push)

[httpd@vm514.dev application_platform]$ git branch -a

* master

  remotes/origin/HEAD -> origin/master

  remotes/origin/faster_ad

  remotes/origin/mallet

  remotes/origin/master

  remotes/origin/profile_201309

  remotes/origin/raven

  remotes/origin/realtime

  remotes/origin/v1.1

  remotes/origin/v1.1_profile_201308

  remotes/origin/v1.1_profile_201309

  remotes/upstream/ims-linking

  remotes/upstream/master

  remotes/upstream/middleware-demo

  remotes/upstream/oregon_standup

  remotes/upstream/profile_201310

  remotes/upstream/profile_201311

  remotes/upstream/raven

  remotes/upstream/realtime-fix

  remotes/upstream/spring_2014

  remotes/upstream/targetReport

  remotes/upstream/unifiedfooter

  remotes/upstream/v1.1

  remotes/upstream/v1.1_profile_201310

  remotes/upstream/v1.1_profile_201311

[httpd@vm514.dev application_platform]$ git pull upstream master

[httpd@vm514.dev application_platform]$ git push

Counting objects: 2775, done.

Compressing objects: 100% (609/609), done.

Writing objects: 100% (2463/2463), 573.12 KiB, done.

Total 2463 (delta 1903), reused 2359 (delta 1823)

To git@git.corp.adobe.com:ligyu/application_platform.git

   429c62f..fde3ae0  master -> master

"sync_upstream4folk_as.sh"

cd appservice

REPOS=$(git remote -v)

if [[ $REPOS =~ .*upstream.* ]]

then

        echo "Upstream has been added!"

else

        git remote add upstream git@git.corp.adobe.com:AdobeAnalyticsWeb/appservice.git

fi

git remote -v

git pull upstream master

git push

git pull origin master

"sync_upstream4folk_as2.sh"

cd appservice

REPOS=$(git remote -v)

if [[ $REPOS =~ .*upstream.* ]]

then

        echo "Upstream has been added!"

else

        git remote add upstream git@git.corp.adobe.com:AdobeAnalyticsWeb/appservice.git

fi

git remote -v

git fetch upstream

git branch –va

git checkout master

git merge upstream/master

git push