How can I view the history of a single branch in EGit for eclipse - eclipse

When reviewing code in eclipse using EGit plugin, before merging it to the develop branch, you switch to the branch and see what files changed with the commits on that branch. For this I would like to see -only- the commits to the current checked out branch. When using Team -> Show in History, I get the complete history across all branches.
How can I view only the commits to the current checked out branch, instead of having to search trough the complete GIT history to find the relevant commits?
Using review tools like Gerrit are not an option.

You can check the filter button in the History View:
All Branches
This toggle activates the "All Branches" mode.
By default, only those commits are shown in the commit log that can be reached from the currently checked out commit, i.e. the Commit Graph ends with the currently checked out commit and newer commits are not shown.
If this button is down, all commits will be shown in the commit log.
This is illustrated in the following picture from our example. The branch "beforeSplit" is currently checked out; by activating the toggle, the newer branches will become visible:
And you need to combine that with:
"Additional Refs" toggles the visibility of certain Refs created during actions like fetch, rebase, merge, for example FETCH_HEAD, ORIGIN_HEAD... This can be helpful to remove clutter from the history view.

You might need to un-check the "Additional Ref" option. please see the attached image.

Related

How to show history of different branch in EGit for Eclipse?

I want to cherry pick some commits of a specific git branch into my currently checked out branch.
To do that I would like to filter the history view EGit offers to see only that one branch.
I know that there's a toggle button that allows me to switch between the display of the commits of the current branch and all branches (). This allows me to see the commits done in the other branch. Though with all the commits of the other branches shown, this gets confusing quickly.
Similarily, there is a button allowing me to select the input, for which the commits are shown (). Though that button only allow to filter the commits by workspace resources of the currently checked out branch.
There is also a button to pin the current history view (), but it doesn't seem to work when I switch between the two branches, the view still gets refreshed.
So, Is there an option, that allows me to restrict the display of commits to a specific branch? Or is there an option to pin the view, so I can keep seeing the commits of the one branch when I check out the other branch?
This worked for Eclipse Oxygen:
Go to: Git Repositories view -> your repository -> branchA -> right-click and choose Show in > History -> (pin this view)
Do the same with other branch, a new view should be opened
Because I couldn't find an option how to restrict the shown commits to a specific branch, I filed a bug in Eclipse's bug tracker.
The answer there was that the code for the input only distinguishes between repositories and files and it currently disregards branches. So it looks like it is not possible to restrict the display of the commits to a specified branch at the moment.

Source tree not able to push

So I make my file changes, but when I try to push them source tree complains that some one else pushed before me.The files are different,yet I am forced to merge the changes. Some times I have to backup and reset my workspace before it can allow me to push again
Is there no way to force the push?
Open SourceTree Preferences
Tab: Advanced
Third checkbox: Allow force push
Enable the checkbox and close Preferences.
Next time you push, there will be an extra checkbox: Force push.
Checking it will also display an additional Confirm Force Push dialog box before the force push is actually performed.
Even though the files are different, you have to perform a merge or a rebase before you can push. The commits from your current working branch have to be merged into the current branch that exists on the server before you can update it. You're merging the branches, not the files.
Using the "force push" command does not force your commits to be applied in addition to what is on the remote branch - it forces your commits to replace the commits on the remote branch. Using this option would throw away all of the commits that had been made by the other user.
Because this is a destructive operation, SourceTree does not include GUI access to the "force push" command. Here's what Steve Streeting from Atlassian says about it:
SourceTree doesn't expose force push because it's almost always not what you want to do.
It means that someone else has pushed before you. What you should be doing is pulling their changes, merging them (or rebasing your changes on top of them), and then pushing.

In GitHub, is there a way to see all (recent) commits on all branches?

In GitHub, is there a way to see all recent commits on all branches. It would be best in reverse chronological order.
Maybe I'm snoopy, but I'd like to be able to see what my developers have been up to recently, at least in terms of commits to the repository on github. So far the closest I've seen is the network graph, which is certainly very useful.
Please note: this is not the right answer, although I hope it continues to be useful. NB it has been made a "Community" answer so I don't receive any points from upvotes
To see all commits for a specific branch (so this does NOT actually answer the original question, which is to see commits across all branches):
Click "Code" (left-most tab) on the main page for the repository. Under those 4 buttons ("master", "Go to file", "Add file", "Code") there is a blue rectangle. At the right end of that is a clock icon and a number. If the viewport of your browser is wide enough it even includes (hurrah) the word "commits". This is a link. Click and ENJOY!!!
NB the URL for this page is like this: https://github.com/myProfile/myRepo/commits/master
This is an old feature of GitHub but not really that intuitive.
Using the GitHub website:
Click a project
Click the 'Insights' tab (moved inside the Meatballs menu)
Click 'Network'
Click on the 'node/circle' for each commit to go to that commit.
Diagram below.
Additionally, you can drag to the left to see all commits throughout time for all forks and branches.
I guess there is no any button which shows you a complete list of commits. If you want to list all commits in a repo, you could browse the following URL:
https://github.com/username/repository/commits
You can view the list of commits by adding the word commits (in plural) at the end of repo URL .
Optionally, you could add some query string to narrow the results in the list. For example:
https://github.com/username/repository/commits?author=johndoe
Update
Thanks to #lii I update this post:
If you want to view all commits in a branch, browse the following URL:
https://github.com/username/repository/commits/branch-name
And you could narrow the list of commits by browsing the following URL:
https://github.com/username/repository/commits/branch-name?author=johndoe
The user interface in GitHub does not currently support a way to see your commits in a branch from the code tab. However, I observed that when I select a branch from the branch selector dropdown, I see the following URL:
// This shows me all commits from all users in the branch called "2.2-stable"
https://github.com/jquery/jquery/commits/2.2-stable
If I click on a username in the list of commits, I observe the following URL:
//This shows me the list of commits from the user "mgol" in the master branch (default branch)
https://github.com/jquery/jquery/commits?author=mgol
So, I thought to myself, why not try to add the query string ?author=mgol to the URL that showed commits on a specific branch:
Solution:
// Show me the list of commits from the user "mgol" on the branch called "2.2-stable"
https://github.com/jquery/jquery/commits/2.2-stable?author=mgol
Again, the user interface has no button that lets you see this view (to the best of my knowledge) but you can manipulate the query string to filter only what you want to see.
Since the 'Insights'/'Network' solution is only available for public/GitHub Team repositories, I found a method that works for both private and public repositories.
github.com/username/reponame/branches
Next to the currently selected branch dropdown, there is a link to github.com/username/reponame/branches
This gives you a (clickable) list of all branches with their most recent commits, in chronological order, as asked in the question:
Although this method does not show all commits (only the most recent one) across all branches, this does allow you to check which of the (new) branches has been updated most recently, and further your investigation. I use this all the time.
Look here: Github API: Retrieve all commits for all branches for a repo this is the only options.
On website you can see only branch specific commits - you need to manually switch between them.
Bitbucket allows to see all commits on all branches.
If viewing this from github.com is not a hard requirement, you can use git:
Clone the project locally, then run the following to show the list of all commits from all branches, sorted by date in descending order:
git log --oneline --all --since="Jan 20 2022"
where --since (and --until) allows you to specify a time range and --all displays commits from every branch including remotes. Alternatively you can replace --all with --branches=*.
You can also display the date and authors with something like this:
git log --oneline --pretty="%C(yellow)%h %C(cyan)%cd %C(magenta)%aN%C(auto)%d %Creset%s" --date-order --date=format:"%y%m%d-%H%M" --all --since="Jan 20 2022"
You can also add --graph switch to get a more structured view instead of a plain list.
Please note: dates may not be reliable to track work: some operations will modify history, e.g. a rebase may update the date of old commits to the date of the rebase, squash may keep the oldest date only, a commit date may be modified arbitrarily, etc.
There is no way to attain that within the original GitHub. But there is a work around.
You could use Le Git Graph (read as legit graph), a browser extension that does exactly this.
Install the extension from here : https://chrome.google.com/webstore/detail/le-git-graph-commits-grap/joggkdfebigddmaagckekihhfncdobff
It will add a new "commits" section to every GitHub repo you open. Open the commits graph and there, all commits across branches will be listed along with the git graph.
Hope it helps!
An upvote would be highly appreciated!
The actions tab has all recent activities done on a repo for all branches.
The way I have my repos setup, each developer has a user.git account. I recommend doing the following:
git fetch --all
This fetch updates all the local copies of remote branches but doesn't create new local branches of these tracking remote branches. If you have local branches of all your developer's branches, you will want to run:
git pull --all
So what you need to do is git fetch --all and then git pull --all. I hope this helps.
Lastly, you can also do git remote update which is the same as git fetch --all
best way to access all commit of a repository is
install app of the GitHub on your PCs
clone repo with that
on the history tab you can find all commit
but you need patient and scroll down on this tab ;)
have a good time
Simply run the following command and keep on pressing enter as you see the details of each commit step by step
git log

Using Subclipse - merge

I created a project, I added it to the repository to the trunk. I made a few changes. I'm looking for the correct way to add a new branch now. He wanted me to work a bit over the appearance of the application. Then, if everything comes out, I wanted to combine the projects into a single new version.
How to do it, ask for directions, links.
Thank you and best regards.
PS: Exactly, I mean that if you do everything as I think it is ok it shows me no call from 5 to 6 on the diagram:
image
On Subclipse subpage for graphs (http://subclipse.tigris.org/graph.html) it states:
When the cache is built, it does not gather any merge information, and when you bring up a graph you will not see any merge information. However, for any given revision in the graph, you can select it and take the "Refresh revision" option. That will go out and get the merge information for that revision, store it in the cache, and re-draw the graph. Using the toolbar, you can refresh all of the revisions on the graph at once, although performance for that option is not always great either.
So you should manually refresh revision graph in order to see 'red merge arrows'. Click on "Reload arrows" and choose "Graph revisions".
Instructions on merging and branching in Subclipse.
First, you would do an svn cp of revision one on the trunk to the branch directory. Then, svn switch to the branch and work on the changes. Once they are approved, you would commit everything to the branch, svn switch back to the trunk, and then perform an svn merge of the branch back onto the trunk. Once SVN has completed the merge, you would test the codebase on the trunk to insure it is functioning correctly and all the capability has been properly merged and do an svn commit to complete the merging of the branch to the trunk.

How can I do the equivalent of git rebase -i HEAD~2 in eGit?

I know how to rebase onto a specific branch or tag using eGit in Eclipse, but I haven't found a way to rebase onto a specific sha1 using eGit. I'd like to do this in order to squash commits before pushing to upstream (ie, doing git rebase -i HEAD~n where n is some number of commits ago where I want to rebase). Is this possible with eGit? If not, is there another Eclipse plugin I should be using that would provide this functionality?
EGit has rebase, but it does not yet have the interactive rebase you ask for.
I've been successful squashing commits using steps from this post (cut and pasted here):
If I want to squash the last m commits on the current branch then I
select in history the first commit which I don't want to squash
right-click and say "Team->Reset->Soft"
right-click and say "Commit". This commit will contain all the changes of the last m commits together
It is currently available in Eclipse Oxygen, it has it's own wizard for it.
Get the branch you want in the History view
Right-click the commit before the one you want to change
Find Rebase interactive and click it
The Rebase wizard will show up with the commits available to work upon
It works just like the console version, but on a GUI. Even if conflicts arise, it will help you through.
From the history view select the commit you want to rebase to, and create a branch called rebase-point or whatever. Voila, you can now rebase to that branch, and delete it later if you want. I generally prefer using a named branch for things like this anyway, because it minimizes the chance for mistakes on my part. Alternately, consider that origin/master is often the right rebase point if you're squashing commits for a push.
You can also rebase from the Eclipse History view.
Select the repository from the Git Repositories view
Right-click and select Show In History
Select the commit you want to rebase the currently checked out branch on top of
Right-click and select the Rebase on Top of item
Note: You may need to select Show All Branches and Tags first from the History view toolbar to display the commit you are looking for in the table.