Github throttled push - github

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)

Related

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

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.

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.

do we get all (i.e. open / closed / merged) pull heads while doing a fetch with * configuration

while checking out github pull heads through a * fetch configuration I retrieved a list of pull heads in the form of ref/pull/* or something similar.
Are these pointing to only open , closed or all pull requests ? and what about the pull requests that have been already merged and closed ?
Depends on which git version you have installed.
It was true prior to git v2.0 build was changed from match to simple
V2. release notes:
When "git push [$there]" does not say what to push, we have used the
traditional "matching" semantics so far (all your branches were sent
to the remote as long as there already are branches of the same name
over there). In Git 2.0, the default is now the "simple" semantics,
which pushes:
only the current branch to the branch with the same name, and only
when the current branch is set to integrate with that remote
branch, if you are pushing to the same remote as you fetch from; or
only the current branch to the branch with the same name, if you
are pushing to a remote that is not where you usually fetch from.
You can use the configuration variable "push.default" to change
this. If you are an old-timer who wants to keep using the
"matching" semantics, you can set the variable to "matching", for
example. Read the documentation for other possibilities.
How does the push configuration related to pull request?
Git hub store the pull request using refspec which means that its behave just like any other branch with the exception that instead of begin placed under /refs/heads/* its is stored under /refs/heads/<pulls (you can change this path- see below)>/*.
So to summarize it:
Github pull reqauests behave the same way as normal refs, depending on your configuration. If you did changed anything and you using git<2 you will get the full list of pull request, if you changed the settings or using git>2 you should only get partial of the pull requests.
Example:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git#github.com:xxx/xxxx.git
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
Fetch all the pull requests: (The pr folder is the one u defined above)
$ git fetch origin
From github.com:xxx/xxx
* [new ref] refs/pull/<id1>/head -> origin/pr/<id1>
* [new ref] refs/pull/<id2>/head -> origin/pr/<id2>
...

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