I have this repository that i forked from another one, and now i need to make a pull request to it, but it says that: "There isn’t anything to compare.", and my commits are not showing:
https://github.com/amorimll/desafio-sharenergy-2023-01
Any help is appreciated, really need this for today.
This is showing in the git rebase:
Short answer
will be checkout to your main branch get the lastest code, then go back to your current working on branch and do git rebase [currentBranchName] main
Explain
so when your create a branch from another branch, is like your created a snapshot code from that branch at that moment. ideally the branch you copied form should prevent make any more changes if possible, until you done working in the new branch and create the PR and done marge it.
what rebase command will do is in case the origin branch had changes, it will pull the latest code form that branch into your working branch first, then to applied any changes you was made for your current working branch. Usually this process will need have some conflict need to fix, if they changed the same file.
Hope this is help you understand :)
Related
Say I have 10 commits in my merge request. I'd like to see all changes made between the first commit and the second to last commit. How can I see this in the GitLab UI?
You can view 'Changes' tab to view all changes in merge request
You can also click on individual commits to view what is changed in that particular commit
You can check diff between two arbitrary commits using https://gitlab.com/$USER/$REPO/compare?from=$SHA1&to=$SHA2
Reference:
https://stackoverflow.com/a/50070145/2073920
Use format
https://gitlab.com/$USER/$REPOSITORY/compare?from=commit_hashtag1&to=commit_hashtag2
For example, You use URL like this
https://gitlab.com/Donhu/java_examples/compare?from=7f844e6b&to=1ff5c89c
I am a git person. In git, after I finishing a little feature, I will submit the branch to review and start a new branch to work on new features.
For example, I had submitted a code recview for feature A, and it is still under review. At this time, I want to start working on feature B, assuming feature A's code will be merged in the near future. In Git, typically I just create a new branch to work on the new feature, if there is some problem with feature A I can easily switch back to branch A to fix it and merge the fixed version to my new feature branch.
How's it achieved in perforce? Should I copy the whole code somewhere as a way to manage branch myself?
You can do this in Perforce exactly the same way you'd do it in Git, if you like -- create your feature B branch and work on feature B there. If you need to make changes to your feature A branch, those can be merged back to your mainline and/or your feature B branch.
If you do your code reviews as shelves, you can have any number of them in development at a time; a shelved change is effectively "rebased" onto submitted changes when you sync+resolve.
FWIW, usually the way I've done reviews in Perforce is to make my changes on my own development branch, set up the merge to the mainline, and then shelve that for review. That way I can continue work on my development branch uninterrupted, I don't need to create a new branch, and if there's a fix needed to my merge-in-progress I can just amend the shelved change (either by submitting the fix to my branch and adding it to the merge, or making the edit as part of the merge operation); it also has the benefit of making conflict resolution (if any) part of the change under review.
What is the easiest/best way to review a merge request in gitlab for a branch that has many commits?
Is there a “unified” view I can use somehow or is the only option to click on the “Changes” tab and go through each individual commits one by one?
You do not need to go through each invidividual commit one by one.
You should click on the Merge Request's "Changes" tab, instead of the "Changes" tab of individual commits, so you see the changes between the latest version and the branch you want to merge into, e.g. with Master:
This way, you will see all changes that are proposed within the merge request and you can review them all at once.
I know there might be some questions similar to this, but mine is a bit odd.
I have branch master and A. I want to create branch B from A, then merge B back to both master and A.
However, I miscreated B from master, then merge it to A. I reverted the merge, but now Gitlab detects A is up-to-date with master, which is not.
Not sure if this is a known issue. Please help, I really appreciate.
Instead of reverting the merge, try and reset A (git reset --hard A~) and, if you can (meaning if no one worked on A), to force push it (git push --force)
You might have to unprotect branch A in GitLab first.
I need to forbid pushing of specific commit (by its sha). Is it possible to do with gitolite configuration?
I tried specifying something like
repo myRepo
- 794b62a8b1cf4417c8320a261177b43bd5d8331e = #all
But it does not work as intended. I guess that VREFs can help here but I din't find much info on that.
You can set in place a VREF which will list commits pushed and reject the push if one of those commits matches the one you want to block.
Check as an example src/VREF/MERGE-CHECK, which does use git rev-list to list commits.
See Adding a VREF to implement and add your own.