我怎样把我最后的N国言混为一谈。
Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...
我怎样把我最后的N国言混为一谈。
使用git rebase -i < subsequently-this-commit>
,并替换“pick”在第二个和其后的“squash”或“fix”,如。
例如,< subsequently-this-commit>
要么是SHA1'h,要么是现有分行的相对地点,根据该分行承诺对重新基底指挥进行分析。 例如,如果用户希望从目前的欧洲复兴开发银行那里看到5项承诺,则指令是<编码>git rebase-i HEAD~5。
You can do this fairly easily without git rebase
or git merge --squash
. In this example, we ll squash the last 3 commits.
If you want to write the new commit message from scratch, this suffices:
git reset --soft HEAD~3 &&
git commit
如果你想开始编辑新的承诺信息,并对现有承诺信息进行分类(即类似于“ pick/ash”/.../squashgit rebase-i
指示清单,则你需要提取这些信息,并将之通过<>条/代码>:
git reset --soft HEAD~3 &&
git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
Both of those methods squash the last three commits into a single new commit in the same way. The soft reset just re-points HEAD to the last commit that you do not want to squash. Neither the index nor the working tree are touched by the soft reset, leaving the index in the desired state for your new commit (i.e. it already has all the changes from the commits that you are about to “throw away”).
You can use git merge --squash
for this, which is slightly more elegant than git rebase -i
. Suppose you re on master and you want to squash the last 12 commits into one.
WARNING: First make sure you commit your work—check that git status
is clean (since git reset --hard
will throw away staged and unstaged changes)
Then:
# Reset the current branch to the commit just before the last 12:
git reset --hard HEAD~12
# HEAD@{1} is where the branch was just before the previous command.
# This command sets the state of the index to be as it would just
# after a merge from that commit:
git merge --squash HEAD@{1}
# Commit those squashed changes. The commit message will be helpfully
# prepopulated with the commit messages of all the squashed commits:
git commit
rel=“noreferer”>documentation for git mer
更详细描述了<代码>-squash备选办法。
git reset -soft HEAD~12 && git commitments
proposed by Chris Johnsen in his response is that You have contributed information/
http://www.ohchr.org。
git reset --soft HEAD~2
git commit -m "new commit message"
git push -f
2 即最后两项承诺将兑现。 页: 1
我建议尽可能避免<条码>(git reset>)——特别是对于Gite-novices。 除非你真的需要根据承诺的
git merge --squash (working branch name)
git commit
The commit message will be prepopulated based on the squash.
git rebase -i HEAD~3
This is handy as it works even when you are on a local branch with no tracking information/remote repo.
指挥部将开设互动数据库编辑,然后按照正常情况重新排列顺序、打字、改写。
www.un.org/Depts/DGACM/index_spanish.htm 利用互动数据库编辑:
互动数据库编辑显示了最后三项承诺。 这一限制由<代码>HEAD~3确定。 指挥系统<代码>git rebase -i HEAD~3。
最新承诺(HEAD
)首先在线上展示。 1. 从<代码>#开始的行文为评论/文件。
所展示的文件相当清楚。 在任何特定线路上,你可以把指挥从<条码>pick改为你选择的指挥。
I prefer to use the command fixup
as this "squashes" the commit s changes into the commit on the line above and discards the commit s message.
As the commit on line 1 is HEAD
, in most cases you would leave this as pick
.
You cannot use squash
or fixup
as there is no other commit to squash the commit into.
你也可以改变承诺的次序。 这使得你能够qu清或固定不相邻的承诺。
A practical everyday example
我最近承诺了一个新特点。 从那时起,我已承付两套保.。 但是,现在我发现,在我所承诺的新特点中,出现了一种 b(或可能只是一种拼错)。 怎么说! 我不想再作一次新的行动,对我的承诺历史进行投票!
我所做的第一件事是纠正错误,并对评论<条码>作出新的承诺,将这一条纳入我的新特点!
然后,我操作<代码>gitlog或gitk
,并获取新的特征(此处为1ff9460
)。
其次,我召集互动式数据库编辑<代码>git rebase-i 1ff9460~。 <代码>~ 之后,SHA告知编辑,将承诺列入编辑。
其次,我把含有固定装置(fe7f1e0
)的承诺移至该特征的后面,并将<代码>pick/code>改为upfix
。
在关闭编辑时,固定装置将渗入主物,我的承诺历史将看清冰和干净!
如果所有承诺都是地方性的,但如果你试图改变已经推向遥远的人们的任何承诺,就会真正给已经检查同一部门的其他发展中国家造成问题!
以。
添加一个来自bash的全球“ash子”(或视窗的Gite Bash)
git config --global alias.squash !f(){ git reset --soft HEAD~${1} && git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"; };f
......或使用Windows上尉
git config --global alias.squash "!f(){ git reset --soft HEAD~${1} && git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"; };f"
Your ~/.gitconfig
should now contain this alias:
[alias]
squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"; };f"
Usage:
git squash N
...... 哪一个自动把最后的<代码>N结合在一起,就包括在内。
注:由此而产生的承诺信息是所有未兑现承诺的组合。 如果你不赞同,你可以总是<代码>git承付——amend,以人工修改。 (按字母顺序排列,与贵方格相匹配)
在分支机构中,你希望把承诺结合起来:
git rebase -i HEAD~(n number of commits back to review)
例如:
git rebase -i HEAD~2
这将打开文字编辑的大门,如果你愿意将这些名字合并起来的话,你就必须把这辆卡车开到每一辆车前面。 文件:
例如,如果你想把所有承诺合并为一项承诺,那么,请购单是你作出的第一个承诺,今后所有承诺(列于第1类)都应被 set。 如果使用正文,则使用:x,插入节约和退出编辑的方式。
接着继续调整基础:
git add .
git rebase --continue
更多关于重写历史的这种和其他方式,见。
你们可以在指挥下这样做。
git rebase -i HEAD~n
注 接着,你选择了办法。
pick 01d1124 Message....
pick 6340aaa Message....
pick ebfd367 Message....
pick 30e0ccb Message....
最新信息如下:pick
1 和squash
。 在最近,
p 01d1124 Message....
s 6340aaa Message....
s ebfd367 Message....
s 30e0ccb Message....
详情请上Link。
Here is another visual example of what would follow after executing:
git rebase -i HEAD~3
If you use TortoiseGit, you can the function Combine to one commit
:
Show Log
Combine to one commit
from the context menuThis function automatically executes all necessary single git steps. Unfortunatly only available for Windows.
很多答复是以<代码>git rebase的指令为依据的,但从我的经验来看,这一指示有些复杂,而且对于gin子来说也有些先进。
让我说,你想要 last过去3年的承诺。 然后是:
git log -1 --oneline
and note the commit-id of the present state (just in case you do something wrong with git reset)git reset --soft HEAD~3
you ll go back 3 commits (and sort of forget that you ve had made these three commits earlier)git commit -m <NEW_SINGLE_MESSAGE>
which will automatically combine the three commits under your message如果有点燃错误的话,你可以再次通过<条码>git reset --soft <ORIGINAL_COMMIT>回到原来的状态。
,Anomies accreditation/a> 是好的,但我感到对此事不安全,因此我决定添加一 couple屏幕。
见gitlog
。 最重要的是,发现首项承诺中的 has子希望qu。 只有:
具体如下:
$ git rebase -i 2d23ea524936e612fae1ac63c95b705db44d937d
就我而言,我要把首次作出的承诺推上一切。 顺序从头到最后,这正是<编码>git 日志/代码>中的其他方式。 就我而言,我想:
如果你只挑出一件事, rest掉其余部分,你可以调整一个承诺信息:
That s it. Once you save this (:wq
), you re done. Have a look at it with git log
.
我认为,这样做最容易的方式是,根据主人翁精神和做“<条码>合并——Squash条码”的新分支。
git checkout master
git checkout -b feature_branch_squashed
git merge --squash feature_branch
Then you have all of the changes ready to commit.
(1) 查明承诺的短 hash
# git log --pretty=oneline --abbrev-commit
abcd1234 Update to Fix for issue B
cdababcd Fix issue B
deab3412 Fix issue A
....
www.un.org/spanish/ecosoc 也可以用来获取短 has。
(2) 如果你想qu(合并)最后两件承诺
# git rebase -i deab3412
3) 该编码为nano
的编辑。 页: 1
....
pick cdababcd Fix issue B
pick abcd1234 Update to Fix for issue B
....
4) 将<代码>pick改为squash
页: 1 在重新命名之后,它就好像如下。
....
pick cdababcd Fix issue B
squash abcd1234 Update to Fix for issue B
....
5) 现在节省并关闭<代码>nano编辑。 Press ctrl + o
and press Enter
to Save. 之后,报章<代码>ctrl + x 退出编辑。
然后,nano
的编辑再次开放,必要时更新评论意见。
7) Now its squashed successfully, you can verify it by checking logs.
# git log --pretty=oneline --abbrev-commit
1122abcd Fix issue B
deab3412 Fix issue A
....
8) 如今,我们开始重新发起。 添加<代码>+在分支名称前签字。 这意味着强迫推进。
# git push origin +master
注: 依据的是<代码>ubuntu。 如果你使用不同的斜体(Windows/code>或
Mac
),那么除编辑外,上面的指令相同。 你可能会有不同的编辑。
git add <files>
--fixup
option and the OLDCOMMIT
should be on which we need to merge(squash) this commit.git commit --fixup=OLDCOMMIT
现在,这在欧洲开发协会的顶端产生了一项新的承诺,其编号为fixup1 <OLDCOMMIT_MSG>
。
OLDCOMMIT
.git rebase --interactive --autosquash OLDCOMMIT^
Here ^
means the previous commit to OLDCOMMIT
. This rebase
command opens interactive window on a editor (vim or nano) on that
we no need to do anything just save and exiting is sufficient. Because the option passed to this will automatically move the latest
commit to next to old commit and change the operation to fixup
(equivalent to squash). Then rebase continues and finishes.
--amend
can be used with git-commit
. # git log --pretty=oneline --abbrev-commit
cdababcd Fix issue B
deab3412 Fix issue A
....
# git add <files> # New changes
# git commit --amend
# git log --pretty=oneline --abbrev-commit
1d4ab2e1 Fix issue B
deab3412 Fix issue A
....
1d4ab2e1
举例来说,如果你想要将最后3项承诺分成一个分支(即:https://bitbucket.org。
我所做的是
git reset --soft HEAD~3
git commit
git push origin <branch_name> --force
如果你处于一个遥远的分支(所谓的feature-branch
),由金库保存(golden_repo_name
),那么,这里就把你的承诺推向一个方面:
Checkout the golden repo
git checkout golden_repo_name
Create a new branch from it(golden repo) as follows
git checkout -b dev-branch
Squash与你的地方分支机构合并,你已经这样做。
git merge --squash feature-branch
Commit your changes (this will be the only commit that goes in dev-branch)
git commit -m "My feature complete"
向贵处地方储存库保住处
git push origin dev-branch
兑现最后10项承诺:
git reset --soft HEAD~10 && git commit -m "squashed commit"
如果你也希望更新边远处,并兑现承诺:
git push -f
What can be really convenient:
Find the commit hash you want to squash on top of, say d43e15
.
现在使用
git reset d43e15
git commit -am new commit name
如果你作出许多承诺,<>
<代码>git rebase -i Master, 然后发布键盘,一到编辑
你们会看到这一点:
pick etc1
pick etc2
pick etc2
改为 f
和_esc y :wq
pick etc1 //this commit will the one commit
f etc2
f etc2
指挥
git push origin +head
method 2 if you have few commits you can do this to delete a commit, you need to do same for delete your second commit and so on
git reset --soft HEAD^1 // or git reset --soft head~1
git commit --amend //then press `:wq`
git push -f
如果你已经作出承诺,你有意再提出另一承诺,则<>方法3<>
git add files...
git commit --amend //then press `:wq`
git push origin +head
simple solution:
www.un.org/Depts/DGACM/index_spanish.htm
www.un.org/Depts/DGACM/index_french.htm
如果你想要打上
git checkout --orphan <new-branch>
git commit
这是一种超高温,但是一种冷却的方式,因此,我只是把它 into入ring子:
GIT_EDITOR= f() { if [ "$(basename $1)" = "git-rebase-todo" ]; then sed -i "2,$s/pick/squash/" $1; else vim $1; fi }; f git rebase -i foo~5 foo
翻译:提供新的“编辑”,如果要编辑的档案名称为git-rebase-todo
(互动性数据库迅速)除第一个“pick”改为“squash”,否则就会引人振动——这样,当你催复时,你就会发现 s的承付信息。 (显然,我qu上了最后五项承诺,但你可以改变,不管你喜欢。)
不过,我可能做的是。
鉴于你目前是你想要qu的分支部门,总经理是该处的,最新承诺载有承诺的信息,并作者希望使用:
git reset --soft $(git merge-base HEAD master) && git commit --reuse-message=HEAD@{1}
(MASTER)
Fleetwood Mac Fritz
║ ║
Add Danny Lindsey Stevie
Kirwan Buckingham Nicks
║ ╚═══╦══════╝
Add Christine ║
Perfect Buckingham
║ Nicks
LA1974══════════╝
║
║
Bill <══════ YOU ARE EDITING HERE
Clinton (CHECKED OUT, CURRENT WORKING DIRECTORY)
https://github.com/fleetwood-mac/band-history/about-our-band-starting-1967.md#i-cant-believe-you- actual-clicked-this”rel=“noreferer” 存放者已提出拉动要求,要求把比尔·克林顿承诺纳入原始文书(<条码>MASTER)。 Primwood Mac承付。
You opened a pull request and on GitHub you see this:
四项承诺:
想没有人会想读一下完整的保存历史。 (实际上是一个存放处,点击上述链接!) 你决定兑现这些承诺。 因此,你去并操作<条码>git reset-soft HEAD~4 && git Rat/code>。 接着,请<代码>git 推介 -force,将其贴在Gite Hub,以清理您的PR。
情况如何? 你刚刚作出从弗里茨到比尔·克林顿的单一承诺。 因为你想到,昨天你正在制作该项目的Buckingham Nicks版本。
git checkout
themgit reset --soft
thatgit commit
that warps directly from the from to the toIf you don t care about the commit messages of the in-between commits, you can use
git reset --mixed <commit-hash-into-which-you-want-to-squash>
git commit -a --amend
Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...
I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...
I have a svn repo with various apps as subdirectory of a single svn repo. That worked because I could have checked out a partial, repo. As I cant do that with git obviously I need multiple repos. I ...
I understand how to merge branches together in git, and I love how easy it makes it. I have a branch that looks like this: project/ |--subproj1/ | |---(files) | |--subproj2/ |---(files) A ...
We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...
I get this on every git svn command I try. I am using git version 1.6.4.2 on OS 10.6 The initial git svn fetch works, and i can do further fetches after that, but they do not enter the log or update ...
Given I have a master branch and a other branch. In the other branch are files I don t want to commit (e.g. log files) so I ignored them in .gitignore. When I switch to the master branch, these ...
Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...