Bitbucket git push commits without cloning the repo
I have a list of paths for configuration files that are stored in various Bitbucket repositories. I tried to download only those files for processing via an automated script.
- your branch is behind by 2 commits
- How to set up bitbucket when you have a project folder with previous .git files?
- How to push to a remote branch without providing the full push refspec?
- What are possible issues with Git / Mercurial in small developer team?
- Push to multiple remote repositories from a single local repo in Mercurial
- Removing branch mapping in Team Foundation Server 2010
I have successfully achieved that using a Python script that automates Bitbucket API 1.0 with OAuth, and I don’t have trouble retrieving the files nor processing them.
The actual problem
So now my problem is, now that I’ve processed the files, how do I commit the diffs (via automated script) and push them back up to the remote repositories? I don’t think Git typically supports single-file modifications.
Things I have considered:
Cloning every single required repository, and using terminal calls to git commit, etc. to commit and push back up to the remotes. (Disadvantage: the repos are quite large and it would be cumbersome to clone them all.)
Using git submodules. I am aware git submodules was suggested as a replacement for svn.externals, which would solve my problem fairly well. (Problem: I read the git submodules docs and couldn’t see how it would help in my situation).
Simulating the POST calls to Bitbucket’s recently-implemented Online Editor (Problem: Bitbucket mentioned that it should only be used for testing purposes, and it is liable to change. Also hard to decipher the POST request)
Using SSH for Git? (Don’t think that would help either.)
One Solution collect form web for “Bitbucket git push commits without cloning the repo”
Partial cloning or partial checkout isn’t supported in Git (as detailed in “Partial clone with Git and Mercurial”)
considering that, since git 1.7.10, you can clone only one branch, would it be possible for you to manage those configuration file in a dedicated branch?
git clone -b mybranch --single-branch /url/to/your/git/repo