github insights: how to look for commits of a specific branch - github

Under insights -> commits, I see graph (number of commits X date) for each developer for master branch.
But I want to track this for "develop" branch. How can I?

You can use git shortlog on any given branch to show the username and the number of created commits with:
shortlog -sn --no-merges
you can also add the --since=<date> flag like:
git shortlog -sn --no-merges --since="Nov 1 2020"
There are many more flags available follow the link to read the documentation.

Related

git branch -vv seems to contradict itself when trying to work out whether by how many commits it is ahead/behind when tracking with remote branches

$ git status
On branch CurrAsOf18Jan2018
Your branch is up to date with 'remotes/bitbucketFrmWin/master'.
nothing to commit, working tree clean
But I know that my bitbucket repo is ahead by a couple of commits Ques:Do I have to always do a git fetch --all so that my local git can be sure - I thought I was tracking my remote repo bitbucketFrmWin - Anyways I do the following .....
$ git fetch --all
Fetching bitbucketFrmWin
From https://bitbucket.org/FreeFries/simplcontactsvcf
50d1fc6..d79d834 master -> bitbucketFrmWin/master
Good now my local repo can check against the fetched remotes whether it is ahead/behind
$ git status
On branch CurrAsOf18Jan2018
Your branch is behind 'remotes/bitbucketFrmWin/master' by 5 commits, and can be fast-forwarded.
nothing to commit, working tree clean
Okay I am happy with that it is what I thought
$ git branch -vv
* CurrAsOf18Jan2018 50d1fc6 [remotes/bitbucketFrmWin/master: behind 5] Pedantic but done - gitNotes.txt
bitbucketFrmWin/master 58470cd [CurrAsOf18Jan2018: behind 7] This is really crazy - Spent more than a week - Singleton still gives null pointer inJdbcExample2
Now this is what throws me [CurrAsOf18Jan2018: behind 7] (see last output line above) ... It should have said ahead by 5 - after all it is comparing the same remote repo branch. What am I missing in my understanding here ?
$ git merge --no-commit --ff-only d79d834
Updating 50d1fc6..d79d834
Fast-forward
.gitignore | 2 ++
gitNotesUpgradeInstall.txt | 38 ++++++++++++++++++++++++++++++++++++++
sqliteData/testtestdb.sqlite3 | Bin 278528 -> 0 bytes
3 files changed, 40 insertions(+)
create mode 100644 gitNotesUpgradeInstall.txt
delete mode 100644 sqliteData/testtestdb.sqlite3
I go ahead with the git fetch it fast-forward's my local branch - I tell it not to commit - but ignores my request and commits anyways - Why ?
Also my bitbucket branch master is actually already ahead at commit d79d834 but "git branch -vv" above does not show that commit sha signature in it's listing despite the fetch - Why ?
$ git status
On branch CurrAsOf18Jan2018
Your branch is up to date with 'remotes/bitbucketFrmWin/master'.
nothing to commit, working tree clean
Nevertheless git status knows now that it has caught up with my remote branch above and is happy
If someone can throw light on the questions posed above as to whether these are bugs or misunderstanding in the git work flow above - I would be grateful. Thanks.
I go ahead with the git fetch it fast-forward's my local branch - I tell it not to commit - but ignores my request and commits anyways - Why ?
Because there is no commit to be made: it does not make any commit: it just fast-forward your branch HEAD to the remote one.
And bitbucketFrmWin/master is a local branch, not remote one!
Its name is poorly chosen, as it matches the one of a remote: remotes/bitbucketFrmWin/master.
But being local, it is not surprising it too is behind its remote counterpart (which just got updated with git fetch bitbucketFrmWin).
If you want to see your remote as well as local ones, type:
git branch -avv
You will see a remotes/bitbucketFrmWin/master branch as well.

Github throttled push

I want to push changed work from local machine to remote GitHub account.
How can I use github to push only 10-15mb per day and not to attempt entire 1GB, as otherwise will go out of limits?
It can keep running for 10 days or I can restart it each day to upload a 10-15mb chunk.
You can try and git push up to a certain commit.
For example, you have 5 commits A>B>C>D>E pending (for simplicity, ABCDE are commit hashes), and you want to push up to commit "C". The following will then push A, B, and C to origin/master.
git push origin C:master
But if commit D is to big (meaning if, after doing git push origin C:master, a git push origin D:master fails), then you would need to split D (git rebase -i)

JIRA github smartcommit

I am not able to transition any issue or update their state from github state.
I tried following commands :-
git commit -m "NDA-113 #time 1w 2d 4h 30m Total work logged"
git commit -m "NDA-113 #comment Total work logged"
Those commits are coming in development section but smart commit actions are not working.
I tried all the suggestion in Atlassian docs, user email in JIRA and github account is same.
Check what you email on github are same in jira
If your email is the same (which catch me out as my IntelliJ was adjusting my email on commits), then the next most likely cause is that you haven't setup Transition Triggers in your workflow and/or are not calling it in the commit.
Example:
git commit -m "NDA-113 #qa #comment Total work logged"
Where the #qa is the transition to QA lane
Final Note: For sanity double check that you have Switched On Smart Commits

How do you fork a repo whose upstream you've already forked?

I want to fork namecoin/namecoin, but I've already forked bitcoin/bitcoin. The latter is the upstream parent of the former. The forkchain is:
bitcoin/bitcoin -> vinced/namecoin -> namecoin/namecoin
When I fork namecoin/namecoin, Github just redirects me to my myuserid/bitcoin fork, instead of creating a new myuserid/namecoin fork. It appears to Github that they are the same project, but they are not.
Anyone know how to do this?
You can't do this "officially", but you can always add another remote for bitcoin and fetch from that.
git remote add bitcoin-orig git://the/bitcoin/repo/path
git fetch bitcoin-orig
# Merge into your 'master' (CAUTION: This might go badly)
git merge bitcoin-orig/master
# Create a local branch based on the origin
git co -b bitcoin-orig-master bitcoin-orig/master
# Take an individual commit from the original repo and put it into your 'master'
git log bitcoin-orig/master && git cherry-pick <SOME SHA>

Find all commits in a particular branch in GIT

This might be a repeated question but i didn't find exact answers.
Lets say i have 2 branches br1 and br2 with 3 commits each.
br1
commit a
commit b
commit c
br2
commit d
commit e
commit f
When i merge from br2 to br1, git log on br1 show commits a,b,c,d,e,f.
Lets say i have 2 branches br1 and br2 with 3 commits each.
br1 after merge with br2
commit a
commit b
commit c
commit d
commit e
commit f
Is there a way to filter commits that were created on br1 alone? (I have tried git log br1..br2 but is there any other method?)
If the merge was Fast-forward or Automerge, will GIT record any commit for the merge? (i see commit when there is a conflict but not in an automerge)
A branch is just a pointer to a specific commit. So you can't find out from what branch a certain commit came from.
When doing a fast-forward, the only thing that changes is that the commit a certain branch points to is switched, so no extra commit will be recorded. If you do want an extra commit to be recorded, use git merge --no-ff.
I'm not certain why this is important to know, but if it is, then you could create a new branch from br1 and use that branch to merge br2. Then br1 and br2 are unchanged, and you can tell which one includes which changes, while you also have a merge branch containing both sets of changes.
br1
a
b
c
br2
d
e
f
mbr1_2
a
b
c
d
e
f
The problem with git log br1..br2 is that it will try to suppress the commits the commits that are part of br1, but all the commits are part of br1 now, so nothing will show.
What you can do is find the commit right before the merge of br2; git log br1^..br2, but that would only work only if br1 has not moved forward.
In general the best way is to find out the relevant merge, and show the commits that were merged:
git log merge^1..merge^2