rebase | Metaframework I use to build things
kandi X-RAY | rebase Summary
kandi X-RAY | rebase Summary
Rebase is not a framework. It's a meta-framework and set of conventions for building large apps in Laravel. I try to codify how I name things and conventions I use below. I should also note that while this is open for anyone to use, it's really my way of doing things, so while I might be open to changes, I may also not be so don't be super-surprised.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Add share data .
- Create the subscriptions table .
- Drop shared database .
- Returns validation rules .
- Check if a user can reset password .
- Create a new subscription .
- Map the invoice s invoices .
- Add a reset token .
- Handle the request .
- Delete records .
rebase Key Features
rebase Examples and Code Snippets
Community Discussions
Trending Discussions on rebase
QUESTION
I have a question about how rebasing works in git, in part because whenever I ask other devs questions about it I get vague, abstract, high level "architect-y speak" that doesn't make a whole lot of sense to me.
It sounds as if rebasing "replays" commits, one after another (so sequentially) from the source branch over the changes in my working branch, is this the case? So if I have a feature branch, say, feature/xyz-123
that was cut from develop
originally, and then I rebase from origin/develop
, then it replays all the commits made to develop
since I branched off of it. Furthermore, it does so, one develop
commit at a time, until all the changes have been "replayed" into my feature branch, yes?
If anything I have said above is incorrect or misled, please begin by correcting me! But assuming I'm more or less correct, I'm not seeing how this is any different than merging in changes from develop
by doing a git merge develop
. Don't both methods result with all the latest changes from develop
making their way into feature/xyz-123
?
I'm sure this is not the case but I'm just not seeing the forest through the trees here. If someone could give a concrete example (with perhaps some mock commits and git command line invocations) I might be able to understand the difference in how rebase works versus a merge. Thanks in advance!
...ANSWER
Answered 2021-Jun-15 at 13:22" It sounds as if rebasing "replays" commits, one after another (so sequentially) from the source branch over the changes in my working branch, is this the case? "
Yes.
" Furthermore, it does so, one develop commit at a time, until all the changes have been "replayed" into my feature branch, yes? "
No, it's the contrary. If you rebase your branch on origin/develop
, all your branch's commits are to be replayed on top of origin/develop
, not the other way around.
Finally, the difference between merge and rebase scenarios has been described in details everywhere, including on this site, but very broadly the merge workflow will add a merge commit to history. For that last part, take a look here for a start.
QUESTION
I was working with a repo where both origin/master and master were in the same commit. I created several branches one on top of the other. Something like
...ANSWER
Answered 2021-Jun-15 at 04:30Yes. Depending on if the other branches have new commits:
- If the other branches have new commits of their own, simply check each one out and
git rebase origin/master
. - If the other branches don't have new commits of their own, while on a branch you wish to duplicate, you can just re-create the others with
git branch -f branchDothis
, etc. for each branch. Note you could delete them and recreate them, or use the-f
flag which mean "force create even if it already exists". The end result is the same.
QUESTION
ANSWER
Answered 2021-Jun-15 at 06:23The question is what are you trying to achieve.
keep all the commits on feature
branch, only rebase them on top of develop
branch
In this case you did exactly right. You rebase feature
branch on top of develop
branch and you must resolve all conflicts.
Squash feature
branch on top of develop
branch
In this case you can avoid resolving conflicts by:
QUESTION
I bisected problem in kernel and the first bad commit is merge commit:
Parents of 2b90506a8186 (both are good):
Also v5.12-rc2 is good.
I need to do second bisect to find actual first non-merge bad commit (i.e. one of 028a1e968435..2b90506a8186 - 4885 commits or 01d713689441..2b90506a8186 - 46 commits).
I remember previously on similar case I checkouted into one of the parents (first branch) and applied one-by-one all commits from the other parent (second branch) on the top of the first branch. With this special branch, where I needed to solve few conflicts I could rebase as the history was linear.
But I don't remember how I got the list of commits from the other parent.
It was probably quite straightforward, founding it's parent with git log --first-parent
.
But for this case it I'm not able to generate the list, probably due fact that parents are also merge commits.
I tried to read various sources, but no luck:
- https://github.com/git/git/blob/master/Documentation/howto/revert-a-faulty-merge.txt
- https://github.com/git/git/blob/master/Documentation/git-bisect.txt
- https://github.com/git/git/blob/master/Documentation/git-bisect-lk2009.txt
- https://github.com/git/git/blob/master/Documentation/howto/revert-a-faulty-merge.txt
UPDATE I don't believe there is kernel regression for all devices, just problem with device tree for my particular arm64 device. Finding a problematic commit can help me to temporarily revert problematic commit until I find what needs to be fixed in device tree for my device.
...ANSWER
Answered 2021-Jun-12 at 22:41Parents of 2b90506a8186 (both are good): […] I need to do second bisect to find actual first non-merge bad commit
You know merging 2b90506^2 produces a kernel that won't boot on your rig, so that commit has the bug that will show up in integration: it's bad.
QUESTION
I'm currently working on a (laravel) project that should result in two versions, but I find myself constantly rebasing and merging my code. I guess it's my git workflow that is mistaken, but I need some heads up on what I'm doing wrong.
My macro-question is: Much like IntelliJ maintains dozens of IDEs that have almost the same basic functionalities but are built into different versions, is there some specific VCS tactic or best practices for doing so?
In DetailSay I have a project (one code base) that is for two clients A and B. A wants a blue theme and B wants a green one, so currently I just have them on two separate branches. These branches often have client-specific changes.
Now I have a new feature that I want to work on, which applies to both A and B. This is how I do it now:
- Create branch
new_feature_branch
frommain
- Finish the code on
new_feature_branch
- Send PR and merge to
main
- Rebase
client_a_branch
andclient_b_branch
onmain
This works fine on normal features, but when there is a minor bug (say, a typo) on the main branch, having to go over all these every time just so that the patched code could get to the client branches just seem kind of awkward and... unintuitive(?) to me.
I just want to make sure if this is how "multiple versions with same code-base" projects are handled generally? If not, how is it commonly done? (A simple link or keyword to what I should look into would be helpful enough)
I'm totally unaware of how things work in production, and I'm also not confident about my git knowledge, so sorry if this question seems naive or whatsoever.
Thanks in advance!
...ANSWER
Answered 2021-Jun-11 at 04:02For the current use case with minor changes, your current rebase flow should be good enough good. But if its a major dependency of sorts, then you can always use git submodules. As they put it
It often happens that while working on one project, you need to use another project from within it. Perhaps it’s a library that a third party developed or that you’re developing separately and using in multiple parent projects. A common issue arises in these scenarios: you want to be able to treat the two projects as separate yet still be able to use one from within the other.
QUESTION
Most of the teams I've worked on in the past have followed the same workflow when using Git (with some tiny variations):
- Pull the
develop
branch (git checkout develop
) - Create a new feature branch off of it (
git checkout -b feature/XYZ-123
) - Do your work
- When you are ready to create a PR, add and commit your changes (
git add . && git commit -m "some commit message"
), then checkdevelop
back out, pull it (git checkout develop && git pull
) - Switch back over to your feature branch and merge
develop
into it (git checkout feature/XYZ-123 && git merge develop
) - Finally push (
git push -u origin feature/XYZ-123
) and create a PR
We'll call this the "Merge Method". The benefits are that any changes to develop
since you created the branch are now merged into your branch. And so by the time you create a PR, there are no merge conflicts with develop
and the code reviewers can see a clean, conflict-free diff between your branch and develop
.
I am now working on a team that has a similar flow up until the merge step, but then instead of merging develop
into my feature branch, they ask for a rebase from origin/develop
. So the actual steps are:
git checkout develop
git checkout -b feature/XYZ-123
- Do your work
git add . && git commit -m "some commit message"
git checkout develop && git pull
git checkout feature/XYZ-123
- Rebase from
origin/dev
git push -u origin feature/XYZ-123
We'll call this the "Rebase Method". It too produces merge conflict-free PRs, but obviously it must have different pros/cons from the Merge Method explained up above.
I'm wondering what those pros/cons are. What does the Merge Method lend itself to that the Rebase Method lacks, and vice versa? When should one method be used as opposed to the other?
...ANSWER
Answered 2021-Jun-11 at 01:57but obviously it must have different pros/cons from the Merge Method explained up above
Not really. Between reverse merging (as I call it) and rebasing, it's exactly the same effect in the end, namely to try to pick up all the most recent changes from develop
so that (1) the feature branch can be tested accurately and (2) the chances of a merge conflict when merging into develop
are reduced.
The main visible difference between reverse merging and rebasing is the lack of the extra merge commit on the feature branch. That makes rebasing appealing. So:
- Rebasing looks a lot cleaner in the history, because you appear to have started the branch from a much more recent state of
develop
.
But here are some counterclaims:
If there's an incoming conflict, rebasing makes it harder to resolve those conflicts.
You can't rebase after pushing to form the pull request, because that rewrites shared history; whereas you can reverse merge at any time.
Personally I use both! I rebase just before the initial push to form the pull request; if the pull request lives a long time, I reverse merge periodically, and especially just before the actual approval and merge.
QUESTION
Recently I had to squash commits due to several bad commits. Simply doing git pull --rebase origin master
worked for me but my teammate already had merged new history on top of old history. So I want to know is if it is possible to overwrite local history?
Let's say there are three timelines in branches remoteNew
, localOld
and localNew
has hour old commit.
Following works and completely overwrites old history with new history. Though thing to note here is, oldHistory had no new commits after newHistory was created.
...ANSWER
Answered 2021-Jun-06 at 21:05To overwrite local history with remote history, will remove all files, where are only on local history. So be carefully!
QUESTION
I have a personal GitHub repo that I want to use as a starting point for new projects = other repos. This might be very easy for you, but I'm really a beginner, so I hope you can help me with this.
If I make changes to that scaffold repo, I need the option to merge/rebase them into the projects that stem from it. So a GitHub template repo will not do the trick.
I'm thinking of the following solution:
- I have a template repo
username/template-repo
- Create an empty repo (manually or via
git clone
) - Create a new, empty branch
scaffold
(so we havemain
&scaffold
) - Do a
git remote add
, so that thescaffold
branch contains exactly the contents of thetemplate-repo
- Merge or rebase the local
scaffold
into themain
branch - Work in the
main
branch and make commits.
If I want to get the new contents of the template-repo
, I'd do sth like this:
- Git pull
template-repo
intoscaffold
branch - Merge or rebase the
scaffold
branch with themain
branch
I understand how Git works and I know what I need, but I just have difficulty setting this all up. I'd be very grateful if you could point out how I'd do this.
Thanks a lot!
...ANSWER
Answered 2021-Jun-04 at 10:03As already noted in the comments, you are confusing terms. A repository/fork cannot be "compressed" into a single branch. However, I think your explanation is clear enough to give an answer to your question.
You can configure multiple remotes and this seems to be a good use case for this. It is somehow similar as setting an upstream
repository when forking another repository. Instead of upstream
, you basically have a template
repository. Much of the same concepts apply since the fork should get changes from the upstream/template repository.
The setup could be something along these line:
When cloning, you give the remote repository the name template instead of origin:
QUESTION
I have a CI system which pulls code from Github for testing. It starts out with a clone of the repo and then, when a new commit appears, it is given the hash of the commit and does:
git pull --no-rebase origin
git -c advice.detachedHead=false checkout --no-progress
No changes are ever made to the code, nothing is ever pushed, only pulled.
However, every so often git pull
fails with a merge conflict:
Pulling is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm ' hint: as appropriate to mark resolution and make a commit. fatal: Exiting because of an unresolved conflict.
When this happens I've tried doing git reset --hard
as a recovery mechanism and doing the pull
once more but that does not help, the same merge conflict prevents the pull
from working and I'm stuck.
Can anyone tell me the bit of git magic that I'm missing which will always make every pull
succeed, vaping the [non existent] local changes?
ANSWER
Answered 2021-Jun-02 at 23:14If you just want to do tests on said revision, why do you pull into a local branch (and face this kind of messes that happen when you try to merge stuff)? Try fetching and checking out instead:
QUESTION
I am currently working on a GitHub Action that saves my repository to AWS CodeCommit. It looks like this:
...ANSWER
Answered 2021-May-31 at 13:40When using the action/checkout
, you need to add the fetch-depth:0
variable if you wish to fetch all history: reference.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rebase
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page