git-rebase

How to make a git rebase and keep the commit timestamp?

旧城冷巷雨未停 提交于 2019-12-31 17:23:57
问题 I want to make a rebase to remove a certain commit from my history. I know how to do that. However if I do it, the commit timestamp is set to the moment I completed the rebase. I want the commits to keep the timestamp. I saw the last answer here: https://stackoverflow.com/a/19522951/3995351 , however it didn't work. The last important command just showed a new line with > So I am opening a new question. 回答1: The setup Let's say this is the history around the commit you want to remove ... o -

Remove local commit completely from tree

亡梦爱人 提交于 2019-12-31 07:01:27
问题 I have 5 local unpushed commits and I want to delete commit #3 from the tree, so parent of commit #4 would point to commit #2 How would I do that? An image describing what I mean: 回答1: you can use git rebase -i : git rebase -i HEAD~5 allows you to interactively choose which of the last (5 in this case) commits you wish to use, edit, squash,... You will get a file to edit; like this: pick a58f195 commit 1 pick abe6821 commit 2 pick f74035d commit 3 pick 3f171df commit 4 pick afa24a9 commit 5

GIT rebase requires to recommit changes

时间秒杀一切 提交于 2019-12-30 10:42:30
问题 Before anything else, I'm just new to git branching. I wasn't aware that every feature branch should be branched out from master and only use the pre-requisite feature branch with such relation to the next feature branch. I have three branches. master , feature-1 and feature-2 all pushed the a Bitbucket repository (with issue tracking enabled). The thing is commits M4 and M5 are critical commits that all branches should rebase it before committing a merge (task of git rebase ) M1 -- M2 -- M3

git pull --rebase --preserve-merges

半腔热情 提交于 2019-12-29 11:46:13
问题 Short version: Do you need to preserve-merges only if you explicitly merged after you did a local commit? What exactly happens otherwise? Does it reapply your committed code to the merged branch? Please explain when it is useful to git pull --rebase --preserve-merges vs. a regular git pull --rebase ? I read about an issue with git pull --rebase here: http://notes.envato.com/developers/rebasing-merge-commits-in-git/ That could cause code changes to be duplicated. I read here: When will `git

git: Pushing Single Commits, Reordering with rebase, Duplicate Commits

不问归期 提交于 2019-12-29 09:33:02
问题 I want to push several single commits to a git remote repo. I followed Geoff's answer found here to do so: How can I pushing specific commit to a remote, and not the previous commits? The commits I want to push are not at the head, so I have to reorder the commits using rebase first and I used these instructions to do so: http://gitready.com/advanced/2009/03/20/reorder-commits-with-rebase.html Essentially I've done: git clone git commit git commit ... git pull git rebase -i HEAD~3 git push

git: Pushing Single Commits, Reordering with rebase, Duplicate Commits

邮差的信 提交于 2019-12-29 09:32:08
问题 I want to push several single commits to a git remote repo. I followed Geoff's answer found here to do so: How can I pushing specific commit to a remote, and not the previous commits? The commits I want to push are not at the head, so I have to reorder the commits using rebase first and I used these instructions to do so: http://gitready.com/advanced/2009/03/20/reorder-commits-with-rebase.html Essentially I've done: git clone git commit git commit ... git pull git rebase -i HEAD~3 git push

Move multiple non-consecutive commits to different branch

谁说胖子不能爱 提交于 2019-12-25 06:50:47
问题 I've got two branches which shouldn't be directly merged together (yet). However, I need to move two different non-consecutive commits from one branch to the other. I currently have: top-branch: A-B-C-D bottom-branch: X-Y And I want to get: top-branch: A-C bottom-branch: X-Y-B-D 回答1: Assuming that you start from a situation similar to this one: > git log --oneline --graph --all --decorate=short * e08a53c (HEAD, bottom-branch) Y * b659a43 X | * 88612b2 (top-branch) D | * 8b37e26 C | * afe4ffd

Git merge strategy for a specific file depending on rebase / merge

為{幸葍}努か 提交于 2019-12-25 04:14:15
问题 I'm looking for a way to make git use a specific merge strategy (ours / theirs) for a specific file depending whether I am merging or rebasing my feature branch. Let me explain: imagine I have a feature branch 'fb' with changes to a file ".mvn/maven.config". If I merge master into 'fb' I want to keep my file so use the 'ours' strategy (I can define it in the .gitattributes file). But if I rebase 'fb' onto master (instead of merging), I still want to keep my ".mvn/maven.config" of the 'fb'

Git rebase interactive edit for merged feature branches?

最后都变了- 提交于 2019-12-25 01:09:50
问题 What will happen in the following scenario: There is a master branch with endless lifeline New branches are created for features and merged with master when finished. The branch is afterwords deleted At some point i needed to do a change in the feature that was already considered closed (it was merged into master and deleted) X --- --- (feature (branch deleted) / \ / \ a --- --- --- M master What I did was: git rebase --interactive X Did the changes in the source and amended the commit X. I

Rebase-push cycles for git branches

我与影子孤独终老i 提交于 2019-12-24 21:41:11
问题 I'm currently using a github repository with a single branch, based of a master branch of another repository. The github branch is a backup of my work, and definitely not meant for pulling, and as such I'm comfortable with rewriting its history when rebasing from the master repository. My problem is that I want a clean history, and if histories diverge I can't do that. This happens if I do a push ( initial work ) + rebase - the second push is rejected. I have tried to delete the branch and