git push命令_Git Push命令解釋

git push命令

The git push command allows you to send (or push) the commits from your local branch in your local Git repository to the remote repository.

git push命令允許您將提交(或推送 )從本地Git存儲庫中的本地分支發送到遠程存儲庫。

To be able to push to your remote repository, you must ensure that all your changes to the local repository are committed.

為了能夠推送到遠程存儲庫,必須確保已提交對本地存儲庫的所有更改

This command’s syntax is as follows:

該命令的語法如下:

git push <repo name> <branch name>

There are a number of different options you can pass with the command, you can learn more about them in the Git documentation or run git push --help.

您可以通過命令傳遞許多不同的選項,可以在Git文檔中了解有關它們的更多信息,或運行git push --help

推送到特定的遠程存儲庫和分支 (Push to a Specific Remote Repository and Branch)

In order to push code, you must first clone a repository to your local machine.

為了推送代碼,必須首先將存儲庫克隆到本地計算機。

# Once a repo is cloned, you'll be working inside of the default branch (the default is `master`)
git clone https://github.com/<git-user>/<repo-name> && cd <repo-name>
# make changes and stage your files (repeat the `git add` command for each file, or use `git add .` to stage all)
git add <filename>
# now commit your code
git commit -m "added some changes to my repo!"
# push changes in `master` branch to github
git push origin master

To learn more about branches check out the links below:

要了解有關分支的更多信息,請查看以下鏈接:

  • git checkout

    git結帳

  • git branch

    git分支

推送到特定的遠程存儲庫及其中的所有分支 (Push to a Specific Remote Repository and All Branches in it)

If you want to push all your changes to the remote repository and all branches in it, you can use:

如果要將所有更改推送到遠程存儲庫及其中的所有分支,則可以使用:

git push --all <REMOTE-NAME>

in which:

其中:

  • --all is the flag that signals that you want to push all branches to the remote repository

    --all是標志,表示您希望將所有分支推送到遠程存儲庫

  • REMOTE-NAME is the name of the remote repository you want to push to

    REMOTE-NAME是您要推送到的遠程存儲庫的名稱

推入具有力參數的特定分支 (Push to a specific branch with force parameter)

If you want to ignore the local changes made to Git repository at Github(Which most of developers do for a hot fix to development server) then you can use —force command to push by ignoring those changs.

如果您想忽略Github上對Git存儲庫所做的本地更改(大多數開發人員都在對開發服務器進行熱修復),則可以使用–force命令來忽略這些更改。

git push --force <REMOTE-NAME> <BRANCH-NAME>

in which:

其中:

  • REMOTE-NAME is the name of the remote repository to which you want to push the changes to

    REMOTE-NAME是要將更改推送到的遠程存儲庫的名稱

  • BRANCH-NAME is the name of the remote branch you want to push your changes to

    BRANCH-NAME是您要將更改推送到的遠程分支的名稱

推忽略Git的預推鉤 (Push ignoring Git’s pre-push hook)

By default git push will trigger the --verify toggle. This means that git will execute any client-side pre-push script that may have been configured. If the pre-push scripts fails, so will the git push. (Pre-Push hooks are good for doing things like, checking if commit messages confirm to company standards, run unit tests etc…). Occasionally you may wish to ignore this default behavior e.g. in the scenario where you wish to push your changes to a feature branch for another contributor to pull, but your work-in-progress changes are breaking unit tests. To ignore the hook, simply input your push command and add the flag --no-verify

默認情況下, git push將觸發--verify切換。 這意味著git將執行可能已配置的任何客戶端預推腳本。 如果預推送腳本失敗,則git push也將失敗。 (Pre-Push掛鉤非常適合執行諸如檢查提交消息是否符合公司標準,運行單元測試等操作)。 有時,您可能希望忽略此默認行為,例如,在您希望將更改推送到功能分支以供其他貢獻者提取但正在進行的更改破壞了單元測試的情況下。 要忽略該鉤子,只需輸入您的push命令并添加標志--no-verify

git push --no-verify

更多信息: (More Information:)

  • Git documentation - push

    Git文檔-推送

  • Git hooks

    吊鉤

翻譯自: https://www.freecodecamp.org/news/the-git-push-command-explained/

git push命令

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/390901.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/390901.shtml
英文地址,請注明出處:http://en.pswp.cn/news/390901.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

在Java里面使用Pairs或者二元組

問題&#xff1a;在Java里面使用Pairs或者二元組 在Java里面&#xff0c;我的Hashtable要用到一個元組結構。在Java里面&#xff0c;我可以使用的什么數據結構呢&#xff1f; Hashtable<Long, Tuple<Set<Long>,Set<Long>>> table ...回答一 我不認…

github 搜索技巧

1、關鍵詞 指定開發語言 bitcoin language:javascript 2、關鍵詞 stars 數量 forks 數量 bitcoin stars:>100 forks:>50

React JS 組件間溝通的一些方法

剛入門React可能會因為React的單向數據流的特性而遇到組件間溝通的麻煩&#xff0c;這篇文章主要就說一說如何解決組件間溝通的問題。 1.組件間的關系 1.1 父子組件 ReactJS中數據的流動是單向的&#xff0c;父組件的數據可以通過設置子組件的props傳遞數據給子組件。如果想讓子…

數據可視化分析票房數據報告_票房收入分析和可視化

數據可視化分析票房數據報告Welcome back to my 100 Days of Data Science Challenge Journey. On day 4 and 5, I work on TMDB Box Office Prediction Dataset available on Kaggle.歡迎回到我的100天數據科學挑戰之旅。 在第4天和第5天&#xff0c;我將研究Kaggle上提供的TM…

sql limit子句_SQL子句解釋的位置:之間,之間,類似和其他示例

sql limit子句什么是SQL Where子句&#xff1f; (What is a SQL Where Clause?) WHERE子句(和/或IN &#xff0c; BETWEEN和LIKE ) (The WHERE Clause (and/or, IN , BETWEEN , and LIKE )) The WHERE clause is used to limit the number of rows returned.WHERE子句用…

在Java里面使用instanceof的性能影響

問題&#xff1a;在Java里面使用instanceof的性能影響 我正在寫一個應用程序&#xff0c;其中一種設計方案包含了instanceof操作的大量使用。雖然我知道面向對象設計通常試圖避免使用instanceof&#xff0c;但那是另一回事了&#xff0c;這個問題純粹只是討論與性能有關。我想…

Soot生成控制流圖

1.將soot.jar文件復制到工程bin目錄下&#xff1b;2.在cmd中執行如下命令java -cp soot-trunck.jar soot.tools.CFGViewer --soot-classpath .;"%JAVA_HOME%"\jre\lib\rt.jar com.wauoen.paper.classes.Activity其中&#xff0c;JAVA_HOME是jdk目錄&#xff1b;com.w…

Centos 6.5安裝MySQL-python

報錯信息&#xff1a;Using cached MySQL-python-1.2.5.zip Complete output from command python setup.py egg_info: sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 1, in <module&g…

react 最佳實踐_最佳React教程

react 最佳實踐React is a JavaScript library for building user interfaces. It was voted the most loved in the “Frameworks, Libraries, and Other Technologies” category of Stack Overflow’s 2017 Developer Survey.React是一個用于構建用戶界面JavaScript庫。 在S…

先知模型 facebook_Facebook先知

先知模型 facebook什么是先知&#xff1f; (What is Prophet?) “Prophet” is an open-sourced library available on R or Python which helps users analyze and forecast time-series values released in 2017. With developers’ great efforts to make the time-series …

Java里面的靜態代碼塊

問題&#xff1a;Java里面的靜態代碼塊 I was looking over some code the other day and I came across: 前幾天我在看一些代碼時發現&#xff1a; static {... }我是c轉來的&#xff0c;我不知道為啥要這樣干。這個代碼也編譯成功了&#xff0c;沒出錯誤。這里的"stat…

搭建Maven私服那點事

摘要&#xff1a;本文主要介紹在CentOS7.1下使用nexus3.6.0搭建maven私服&#xff0c;以及maven私服的使用&#xff08;將自己的Maven項目指定到私服地址、將第三方項目jar上傳到私服供其他項目組使用&#xff09; 一、簡介 Maven是一個采用純Java編寫的開源項目管理工具, Mave…

lee最短路算法_Lee算法的解釋:迷宮運行并找到最短路徑

lee最短路算法Lee算法是什么&#xff1f; (What is the Lee Algorithm?) The Lee algorithm is one possible solution for maze routing problems. It always gives an optimal solution, if one exists, but is slow and requires large memory for dense layout.Lee算法是迷…

gan訓練失敗_我嘗試過(但失敗了)使用GAN來創作藝術品,但這仍然值得。

gan訓練失敗This work borrows heavily from the Pytorch DCGAN Tutorial and the NVIDA paper on progressive GANs.這項工作大量借鑒了Pytorch DCGAN教程 和 有關漸進式GAN 的 NVIDA論文 。 One area of computer vision I’ve been wanting to explore are GANs. So when m…

怎么樣實現對一個對象的深拷貝

問題&#xff1a;怎么樣實現對一個對象的深拷貝 使用深拷貝的方法有點難實現啊。要保證原來的對象和克隆對象不是共享同一個引用的步驟是什么啊&#xff1f; 回答一 一種安全的方法是先序列化對象&#xff0c;然后反序列化。這保證了所有東西都是一個新的引用。 這里有一篇…

19.7 主動模式和被動模式 19.8 添加監控主機 19.9 添加自定義模板 19.10 處理圖形中的亂碼 19.11 自動發現...

2019獨角獸企業重金招聘Python工程師標準>>> 19.7 主動模式和被動模式 ? 主動或者被動是相對客戶端來講的 ? 被動模式&#xff0c;服務端會主動連接客戶端獲取監控項目數據&#xff0c;客戶端被動地接受連接&#xff0c;并把監控信息傳遞給服務端 服務端請求以后&…

Codeforces Round #444 (Div. 2) C.Solution for Cube 模擬

向題解低頭&#xff0c;向大佬低頭(。﹏。)orz……模擬也不能亂模啊……要好好分析題意&#xff0c;簡化簡化再簡化orz敲黑板 六個面的魔方&#xff0c;能一步還原的情況一定是只有2個面是單色&#xff0c;其余四個面&#xff0c;每個面2種顏色&#xff0c;而且不會出現任意兩面…

fcc認證_介紹fCC 100:我們對2019年杰出貢獻者的年度總結

fcc認證2019 has been a big year for the global freeCodeCamp community.對于全球freeCodeCamp社區來說&#xff0c;2019年是重要的一年。 More people are answering questions on the forum. 越來越多的人在論壇上回答問題。 Our publication has several new, rising aut…

華盛頓特區與其他地區的差別_使用華盛頓特區地鐵數據確定可獲利的廣告位置...

華盛頓特區與其他地區的差別深度分析 (In-Depth Analysis) Living in Washington DC for the past 1 year, I have come to realize how WMATA metro is the lifeline of this vibrant city. The metro network is enormous and well-connected throughout the DMV area. When …

Windows平臺下kafka環境的搭建

近期在搞kafka&#xff0c;在Windows環境搭建的過程中遇到一些問題&#xff0c;把具體的流程幾下來防止后面忘了。 準備工作&#xff1a; 1.安裝jdk環境 http://www.oracle.com/technetwork/java/javase/downloads/index.html 2.下載kafka的程序安裝包&#xff1a; http://kafk…