potiuk commented on issue #6007: Improved and Fixed Apache Glue 
hook/operator/sensor from [AIRFLOW-2310] 
URL: https://github.com/apache/airflow/pull/6007#issuecomment-575881530
 
 
   Let me guide you on this @abdulbasitds -> I think it is great to learn how 
to rebase in git :). I will soon put that into contributor's documentation 
(this is a common question - how to rebase) but I'd love if you tell me it is 
descriptive enough/easy to follow:
   
   First of all - you can read about rebase workflow here: 
https://www.atlassian.com/git/tutorials/merging-vs-rebasing - this is an 
excellent article that describes all ins/outs of rebase. I recommend reading it 
and keeping it as reference.
   
   The goal of rebasing your PR on top of `apache/master` is to "transplant" 
your change on top of the latest changes that are merged by others and that 
changes from your PR do not conflict with those changes from others.
   
   Here is how rebase looks in practice:
   
   1. You need to add Apache remote to your git repository. I usually add it as 
"apache" remote so that i can refer to it easily: 
   `git remote add apache g...@github.com:apache/airflow.git` or
   `git remote add apache https://github.com/apache/airflow.git` if you use 
https
   
   2. You need to make sure that you have the latest master fetched from all 
remotes:
   `git fetch --all`. You want to rebase your changes on top of `apache/master` 
branch.
   
   3. Assuming that your feature is in a branch in your repository called 
`my-branch` you can check easily what is the base commit you should rebase from
   `git merge-base my-branch apache/master` 
   This will return you base commit which you should use to rebase your feature 
- for example: `5abce471e0690c6b8d06ca25685b0845c5fd270f`
   
   4. Make sure you checked out your branch locally:
   `git checkout my-branch`
   
   5. Rebase: 
   `git rebase HASH_ID --onto apache/master`
   for example: 
   `git rebase 5abce471e0690c6b8d06ca25685b0845c5fd270f --onto apache/master`
   
   6. If you have no conflicts - that's cool. You rebased. You can run `git 
push --force-with-lease` to push your changes to your repository. That should 
trigger the build in Travis if you have a Pull Request opened already.
   
   7. While rebasing you might have conflicts. Read carefully what git tells 
you when it tells you about the conflicts. You need to solve the conflicts 
manually. This is sometimes the most difficult part and requires deliberate 
correcting your code looking what has changed since you developed your changes. 
There are various tools that can help you with that. You can use
   `git mergetool` (and you can configure different merge tools. Also you can 
use IntelliJ/PyCharm excellent merge tool. When you open project in PyCharm 
which has conflict you can go to VCS->Git->Resolve Conflicts and ther you have 
one of the most intuitive and nice merge tools I ever used. You can see there 
https://www.jetbrains.com/help/idea/resolving-conflicts.html.
   
   8. After you solved conflicts simply run `git rebase --continue` and go 
either to point 6. or 7. above depending if you have more commits that cause 
conflicts in your PR (rebasing applies each commit from your PR one-by-one).
   
   
   
   
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to