remove git file from repository not having local copy










0















working with git is obvious when u have local copy of repository on disk but sometimes there is requirement to work only with specific file(s) from known address of repository.



So here it is: my target is to delete single file or known list of file in given repo - the hard part is that because of performance reasons i don't want to clone entire repository to disk. I'm using already bitbucket server api but it seems there is no way of doing it. Of course i want to be able to see this operation later in git as a commit.










share|improve this question






















  • You can shallow clone a repo, but you will need to clone at least one commit.

    – evolutionxbox
    Nov 13 '18 at 8:27











  • Doesn't the BitBucket API allow this? community.atlassian.com/t5/Bitbucket-questions/…

    – Clijsters
    Nov 13 '18 at 9:29











  • i'm talking about this api: docs.atlassian.com/bitbucket-server/rest/5.8.2/… which looks like it doesn't support delete file from repo

    – Macko
    Nov 13 '18 at 9:47















0















working with git is obvious when u have local copy of repository on disk but sometimes there is requirement to work only with specific file(s) from known address of repository.



So here it is: my target is to delete single file or known list of file in given repo - the hard part is that because of performance reasons i don't want to clone entire repository to disk. I'm using already bitbucket server api but it seems there is no way of doing it. Of course i want to be able to see this operation later in git as a commit.










share|improve this question






















  • You can shallow clone a repo, but you will need to clone at least one commit.

    – evolutionxbox
    Nov 13 '18 at 8:27











  • Doesn't the BitBucket API allow this? community.atlassian.com/t5/Bitbucket-questions/…

    – Clijsters
    Nov 13 '18 at 9:29











  • i'm talking about this api: docs.atlassian.com/bitbucket-server/rest/5.8.2/… which looks like it doesn't support delete file from repo

    – Macko
    Nov 13 '18 at 9:47













0












0








0








working with git is obvious when u have local copy of repository on disk but sometimes there is requirement to work only with specific file(s) from known address of repository.



So here it is: my target is to delete single file or known list of file in given repo - the hard part is that because of performance reasons i don't want to clone entire repository to disk. I'm using already bitbucket server api but it seems there is no way of doing it. Of course i want to be able to see this operation later in git as a commit.










share|improve this question














working with git is obvious when u have local copy of repository on disk but sometimes there is requirement to work only with specific file(s) from known address of repository.



So here it is: my target is to delete single file or known list of file in given repo - the hard part is that because of performance reasons i don't want to clone entire repository to disk. I'm using already bitbucket server api but it seems there is no way of doing it. Of course i want to be able to see this operation later in git as a commit.







git bitbucket






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 8:01









MackoMacko

141210




141210












  • You can shallow clone a repo, but you will need to clone at least one commit.

    – evolutionxbox
    Nov 13 '18 at 8:27











  • Doesn't the BitBucket API allow this? community.atlassian.com/t5/Bitbucket-questions/…

    – Clijsters
    Nov 13 '18 at 9:29











  • i'm talking about this api: docs.atlassian.com/bitbucket-server/rest/5.8.2/… which looks like it doesn't support delete file from repo

    – Macko
    Nov 13 '18 at 9:47

















  • You can shallow clone a repo, but you will need to clone at least one commit.

    – evolutionxbox
    Nov 13 '18 at 8:27











  • Doesn't the BitBucket API allow this? community.atlassian.com/t5/Bitbucket-questions/…

    – Clijsters
    Nov 13 '18 at 9:29











  • i'm talking about this api: docs.atlassian.com/bitbucket-server/rest/5.8.2/… which looks like it doesn't support delete file from repo

    – Macko
    Nov 13 '18 at 9:47
















You can shallow clone a repo, but you will need to clone at least one commit.

– evolutionxbox
Nov 13 '18 at 8:27





You can shallow clone a repo, but you will need to clone at least one commit.

– evolutionxbox
Nov 13 '18 at 8:27













Doesn't the BitBucket API allow this? community.atlassian.com/t5/Bitbucket-questions/…

– Clijsters
Nov 13 '18 at 9:29





Doesn't the BitBucket API allow this? community.atlassian.com/t5/Bitbucket-questions/…

– Clijsters
Nov 13 '18 at 9:29













i'm talking about this api: docs.atlassian.com/bitbucket-server/rest/5.8.2/… which looks like it doesn't support delete file from repo

– Macko
Nov 13 '18 at 9:47





i'm talking about this api: docs.atlassian.com/bitbucket-server/rest/5.8.2/… which looks like it doesn't support delete file from repo

– Macko
Nov 13 '18 at 9:47












1 Answer
1






active

oldest

votes


















1














All git mutable operations can only work on a working tree. So if you want to do a commit it needs to be applied to a working tree. Whether this one resides on your local machine or somewhere else is equal. But the git executable needs file system access to it. You won't come around this restriction. Even git commands that seem manipulate the repository directly (like --filter-branch) use a temporary working tree.



But you can speed up things when you use a shallow clone (--depth 1) rather than a full clone. This significantly faster.



Note that you need a sufficiently recent git version for this to work. See also here: Better support for shallow clones in git 1.9




Another option is to create a service at the repository server that does the job for you. This is faster because the main traffic is now local.
But of course using a third party git server like butbucket this is not an option.






share|improve this answer























  • What’s a mutable operation in git?

    – evolutionxbox
    Nov 13 '18 at 8:28











  • The opposite of an immutable operation. Take a look at this oxford entry

    – Clijsters
    Nov 13 '18 at 9:26











  • All git mutable operations can only work on a working tree. I doubt that this is true. You may want to take a look at the Plumbing and Porcelain section of the git book. This works on bare repos.

    – Clijsters
    Nov 13 '18 at 9:31











  • so the flow could look like this: (1) shallow clone repo to local folder (2) delete file from local repo folder (3) make commit back to repo ?

    – Macko
    Nov 13 '18 at 11:10










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53276337%2fremove-git-file-from-repository-not-having-local-copy%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














All git mutable operations can only work on a working tree. So if you want to do a commit it needs to be applied to a working tree. Whether this one resides on your local machine or somewhere else is equal. But the git executable needs file system access to it. You won't come around this restriction. Even git commands that seem manipulate the repository directly (like --filter-branch) use a temporary working tree.



But you can speed up things when you use a shallow clone (--depth 1) rather than a full clone. This significantly faster.



Note that you need a sufficiently recent git version for this to work. See also here: Better support for shallow clones in git 1.9




Another option is to create a service at the repository server that does the job for you. This is faster because the main traffic is now local.
But of course using a third party git server like butbucket this is not an option.






share|improve this answer























  • What’s a mutable operation in git?

    – evolutionxbox
    Nov 13 '18 at 8:28











  • The opposite of an immutable operation. Take a look at this oxford entry

    – Clijsters
    Nov 13 '18 at 9:26











  • All git mutable operations can only work on a working tree. I doubt that this is true. You may want to take a look at the Plumbing and Porcelain section of the git book. This works on bare repos.

    – Clijsters
    Nov 13 '18 at 9:31











  • so the flow could look like this: (1) shallow clone repo to local folder (2) delete file from local repo folder (3) make commit back to repo ?

    – Macko
    Nov 13 '18 at 11:10















1














All git mutable operations can only work on a working tree. So if you want to do a commit it needs to be applied to a working tree. Whether this one resides on your local machine or somewhere else is equal. But the git executable needs file system access to it. You won't come around this restriction. Even git commands that seem manipulate the repository directly (like --filter-branch) use a temporary working tree.



But you can speed up things when you use a shallow clone (--depth 1) rather than a full clone. This significantly faster.



Note that you need a sufficiently recent git version for this to work. See also here: Better support for shallow clones in git 1.9




Another option is to create a service at the repository server that does the job for you. This is faster because the main traffic is now local.
But of course using a third party git server like butbucket this is not an option.






share|improve this answer























  • What’s a mutable operation in git?

    – evolutionxbox
    Nov 13 '18 at 8:28











  • The opposite of an immutable operation. Take a look at this oxford entry

    – Clijsters
    Nov 13 '18 at 9:26











  • All git mutable operations can only work on a working tree. I doubt that this is true. You may want to take a look at the Plumbing and Porcelain section of the git book. This works on bare repos.

    – Clijsters
    Nov 13 '18 at 9:31











  • so the flow could look like this: (1) shallow clone repo to local folder (2) delete file from local repo folder (3) make commit back to repo ?

    – Macko
    Nov 13 '18 at 11:10













1












1








1







All git mutable operations can only work on a working tree. So if you want to do a commit it needs to be applied to a working tree. Whether this one resides on your local machine or somewhere else is equal. But the git executable needs file system access to it. You won't come around this restriction. Even git commands that seem manipulate the repository directly (like --filter-branch) use a temporary working tree.



But you can speed up things when you use a shallow clone (--depth 1) rather than a full clone. This significantly faster.



Note that you need a sufficiently recent git version for this to work. See also here: Better support for shallow clones in git 1.9




Another option is to create a service at the repository server that does the job for you. This is faster because the main traffic is now local.
But of course using a third party git server like butbucket this is not an option.






share|improve this answer













All git mutable operations can only work on a working tree. So if you want to do a commit it needs to be applied to a working tree. Whether this one resides on your local machine or somewhere else is equal. But the git executable needs file system access to it. You won't come around this restriction. Even git commands that seem manipulate the repository directly (like --filter-branch) use a temporary working tree.



But you can speed up things when you use a shallow clone (--depth 1) rather than a full clone. This significantly faster.



Note that you need a sufficiently recent git version for this to work. See also here: Better support for shallow clones in git 1.9




Another option is to create a service at the repository server that does the job for you. This is faster because the main traffic is now local.
But of course using a third party git server like butbucket this is not an option.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '18 at 8:27









MarcelMarcel

875217




875217












  • What’s a mutable operation in git?

    – evolutionxbox
    Nov 13 '18 at 8:28











  • The opposite of an immutable operation. Take a look at this oxford entry

    – Clijsters
    Nov 13 '18 at 9:26











  • All git mutable operations can only work on a working tree. I doubt that this is true. You may want to take a look at the Plumbing and Porcelain section of the git book. This works on bare repos.

    – Clijsters
    Nov 13 '18 at 9:31











  • so the flow could look like this: (1) shallow clone repo to local folder (2) delete file from local repo folder (3) make commit back to repo ?

    – Macko
    Nov 13 '18 at 11:10

















  • What’s a mutable operation in git?

    – evolutionxbox
    Nov 13 '18 at 8:28











  • The opposite of an immutable operation. Take a look at this oxford entry

    – Clijsters
    Nov 13 '18 at 9:26











  • All git mutable operations can only work on a working tree. I doubt that this is true. You may want to take a look at the Plumbing and Porcelain section of the git book. This works on bare repos.

    – Clijsters
    Nov 13 '18 at 9:31











  • so the flow could look like this: (1) shallow clone repo to local folder (2) delete file from local repo folder (3) make commit back to repo ?

    – Macko
    Nov 13 '18 at 11:10
















What’s a mutable operation in git?

– evolutionxbox
Nov 13 '18 at 8:28





What’s a mutable operation in git?

– evolutionxbox
Nov 13 '18 at 8:28













The opposite of an immutable operation. Take a look at this oxford entry

– Clijsters
Nov 13 '18 at 9:26





The opposite of an immutable operation. Take a look at this oxford entry

– Clijsters
Nov 13 '18 at 9:26













All git mutable operations can only work on a working tree. I doubt that this is true. You may want to take a look at the Plumbing and Porcelain section of the git book. This works on bare repos.

– Clijsters
Nov 13 '18 at 9:31





All git mutable operations can only work on a working tree. I doubt that this is true. You may want to take a look at the Plumbing and Porcelain section of the git book. This works on bare repos.

– Clijsters
Nov 13 '18 at 9:31













so the flow could look like this: (1) shallow clone repo to local folder (2) delete file from local repo folder (3) make commit back to repo ?

– Macko
Nov 13 '18 at 11:10





so the flow could look like this: (1) shallow clone repo to local folder (2) delete file from local repo folder (3) make commit back to repo ?

– Macko
Nov 13 '18 at 11:10

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53276337%2fremove-git-file-from-repository-not-having-local-copy%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto