Git push

git push :发布本地分支的代码到远程仓库分支

1 . 本地代码做了修改之后的状态如下,通过git checkout — <file>执行撤销文件的修改。

ysqdeMacBook-Pro:lollicupStore2 ysq$ git status
On branch sun-dev
Your branch is up to date with 'origin/sun-dev'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   app/design/frontend/lollicupstore/default/template/customer/account/dashboard/product.phtml
	modified:   app/design/frontend/lollicupstore/default/template/customerproduct/history.phtml
	modified:   media/customer/P/e/Permit.jpg
	modified:   media/customer/R/e/Resale_Certificate.pdf
	modified:   media/customer/R/e/Reseller_Permit.pdf
	modified:   media/customer/S/E/SELLER_PERMIT.pdf
	modified:   skin/frontend/lollicupstore/default/css/styles.css

no changes added to commit (use "git add" and/or "git commit -a")

2 . 将修改的代码执行 git add 操作然后查看其本地分支代码的状态,通过:git reset HEAD <file> 可以执行还原(撤销git add)操作

ysqdeMacBook-Pro:lollicupStore2 ysq$ git add app/design/frontend/lollicupstore/default/template/customer/account/dashboard/product.phtml
You have new mail in /var/mail/ysq
ysqdeMacBook-Pro:lollicupStore2 ysq$ git add app/design/frontend/lollicupstore/default/template/customerproduct/history.phtml
ysqdeMacBook-Pro:lollicupStore2 ysq$ git add skin/frontend/lollicupstore/default/css/styles.css
ysqdeMacBook-Pro:lollicupStore2 ysq$ git status
On branch sun-dev
Your branch is up to date with 'origin/sun-dev'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	modified:   app/design/frontend/lollicupstore/default/template/customer/account/dashboard/product.phtml
	modified:   app/design/frontend/lollicupstore/default/template/customerproduct/history.phtml
	modified:   skin/frontend/lollicupstore/default/css/styles.css

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   media/customer/P/e/Permit.jpg
	modified:   media/customer/R/e/Resale_Certificate.pdf
	modified:   media/customer/R/e/Reseller_Permit.pdf
	modified:   media/customer/S/E/SELLER_PERMIT.pdf

ysqdeMacBook-Pro:lollicupStore2 ysq$ 

3. clear操作可以清屏操作:

ysqdeMacBook-Pro:lollicupStore2 ysq$ clear
ysqdeMacBook-Pro:lollicupStore2 ysq$ 

4 . git status 操作可以查看本地分支代码的状态

ysqdeMacBook-Pro:lollicupStore2 ysq$ git status
On branch sun-dev
Your branch is up to date with 'origin/sun-dev'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	modified:   app/design/frontend/lollicupstore/default/template/customer/account/dashboard/product.phtml
	modified:   app/design/frontend/lollicupstore/default/template/customerproduct/history.phtml
	modified:   skin/frontend/lollicupstore/default/css/styles.css

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   media/customer/P/e/Permit.jpg
	modified:   media/customer/R/e/Resale_Certificate.pdf
	modified:   media/customer/R/e/Reseller_Permit.pdf
	modified:   media/customer/S/E/SELLER_PERMIT.pdf

ysqdeMacBook-Pro:lollicupStore2 ysq$ 

5 .针对做了git add 操作的代码,接下来需要操作 git commit -m “注释”

ysqdeMacBook-Pro:lollicupStore2 ysq$ git commit -m "add to cart button on my account"
[sun-dev 780cc15e] add to cart button on my account
 3 files changed, 9 insertions(+), 9 deletions(-)
ysqdeMacBook-Pro:lollicupStore2 ysq$ git status
On branch sun-dev
Your branch is ahead of 'origin/sun-dev' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   media/customer/P/e/Permit.jpg
	modified:   media/customer/R/e/Resale_Certificate.pdf
	modified:   media/customer/R/e/Reseller_Permit.pdf
	modified:   media/customer/S/E/SELLER_PERMIT.pdf

no changes added to commit (use "git add" and/or "git commit -a")
ysqdeMacBook-Pro:lollicupStore2 ysq$ 

6. 使用git push将git commit 提交之后的代码推送到远程仓库中。

ysqdeMacBook-Pro:lollicupStore2 ysq$ git push
Username for 'https://github.com': 421072757@qq.com
Password for 'https://421072757@qq.com@github.com': 
Enumerating objects: 37, done.
Counting objects: 100% (37/37), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (17/17), done.
Writing objects: 100% (20/20), 1.74 KiB | 593.00 KiB/s, done.
Total 20 (delta 9), reused 0 (delta 0)
remote: Resolving deltas: 100% (9/9), completed with 9 local objects.
To https://github.com/lollicupusa/lollicupStore2.git
   205c3dd2..780cc15e  sun-dev -> sun-dev
ysqdeMacBook-Pro:lollicupStore2 ysq$ 

Leave a comment

您的电子邮箱地址不会被公开。 必填项已用*标注