git-rebase

Remove folder and its contents from git/GitHub's history

☆樱花仙子☆ 提交于 2019-12-17 01:25:29
问题 I was working on a repository on my GitHub account and this is a problem I stumbled upon. Node.js project with a folder with a few npm packages installed The packages were in node_modules folder Added that folder to git repository and pushed the code to github (wasn't thinking about the npm part at that time) Realized that you don't really need that folder to be a part of the code Deleted that folder, pushed it At that instance, the size of the total git repo was around 6MB where the actual

What's the difference between 'git merge' and 'git rebase'?

余生颓废 提交于 2019-12-16 22:19:15
问题 What's the difference between git merge and git rebase ? 回答1: Suppose originally there were 3 commits, A , B , C : Then developer Dan created commit D , and developer Ed created commit E : Obviously, this conflict should be resolved somehow. For this, there are 2 ways: MERGE : Both commits D and E are still here, but we create merge commit M that inherits changes from both D and E . However, this creates diamond shape, which many people find very confusing. REBASE : We create commit R , which

Edit the root commit in Git?

孤街浪徒 提交于 2019-12-16 20:09:05
问题 There's ways to change the message from later commits: git commit --amend # for the most recent commit git rebase --interactive master~2 # but requires *parent* How can you change the commit message of the very first commit (which has no parent)? 回答1: Assuming that you have a clean working tree, you can do the following. # checkout the root commit git checkout <sha1-of-root> # amend the commit git commit --amend # rebase all the other commits in master onto the amended root git rebase --onto

Git workflow and rebase vs merge questions

梦想的初衷 提交于 2019-12-16 19:49:07
问题 I've been using Git now for a couple of months on a project with one other developer. I have several years of experience with SVN, so I guess I bring a lot of baggage to the relationship. I have heard that Git is excellent for branching and merging, and so far, I just don't see it. Sure, branching is dead simple, but when I try to merge, everything goes all to hell. Now, I'm used to that from SVN, but it seems to me that I just traded one sub-par versioning system for another. My partner

Git workflow and rebase vs merge questions

心不动则不痛 提交于 2019-12-16 19:44:53
问题 I've been using Git now for a couple of months on a project with one other developer. I have several years of experience with SVN, so I guess I bring a lot of baggage to the relationship. I have heard that Git is excellent for branching and merging, and so far, I just don't see it. Sure, branching is dead simple, but when I try to merge, everything goes all to hell. Now, I'm used to that from SVN, but it seems to me that I just traded one sub-par versioning system for another. My partner

Git workflow and rebase vs merge questions

こ雲淡風輕ζ 提交于 2019-12-16 19:44:36
问题 I've been using Git now for a couple of months on a project with one other developer. I have several years of experience with SVN, so I guess I bring a lot of baggage to the relationship. I have heard that Git is excellent for branching and merging, and so far, I just don't see it. Sure, branching is dead simple, but when I try to merge, everything goes all to hell. Now, I'm used to that from SVN, but it seems to me that I just traded one sub-par versioning system for another. My partner

git rebase -i with squash cannot detach HEAD

我是研究僧i 提交于 2019-12-14 04:17:28
问题 Using the latest git ( 2.1.0.24 ), whenever I try to git rebase -i to squash some commits, the squash cannot detach HEAD state. I expect it to squash the commits and put me back on my branch as I expected. There are no unstaged files, changes in my working tree, or anything in the stash. Why is it doing this? > [master] » git rebase -i HEAD~3 (I squash a few commits)... pick c9e9b62 Fixes super important bug #123. squash c0dc9f9 wip pick 5385a37 wip2 # Rebase fb83e59..5385a37 onto fb83e59

Git rebase for a branch created days back

放肆的年华 提交于 2019-12-13 15:23:25
问题 I need help in understanding git rebase for this situation. I checked out a branch created by some one 10 days back. I checked out using git checkout -b <some name> origin/branchname (I just used different name to identify it) After checkout, if I do rebase by being in this checked out branch, git rebase origin/master It shows some errors like 1) Trailing whitespace - I read about this but even after trying this command that I found online, i still see the warnings. git config core.whitespace

editing commits with git rebase

左心房为你撑大大i 提交于 2019-12-13 14:51:41
问题 I'm having a problem with editing commits. I have 2 commits for 2 .php files. My goal is to edit them both. I read about rebase -i and this is what I reckon is supposed to be done: first I change pick to edit ; save and exit; rebase stops; type git commit --amend ; make changes, save and close the text editor; type git rebase --continue . After this I believe the rebase stops again and I have to do this all over again for the second commit. But right after I type git rebase --continue i get

Why does Git give “Unknown command: pick” during an interactive rebase?

非 Y 不嫁゛ 提交于 2019-12-13 08:17:06
问题 I did: git rebase mybranch --interactive And I edited my rebase-todo file to something like this: pick aec2c2b Add foo method to bar edit 8441f4b Do something slightly wrong pick dabcc80 Do something else correctly But when I told Git to make it happen, I got: Unknown command: pick aec2c2b8f9c314f9dddc67a2c71f8be0a27c0fab Add foo method to bar Please fix this using 'git rebase --edit-todo'. What? But pick is a valid command! Why did this happen, and how can I fix it? Output of git --version