Algunas preguntas sobre Git [cerrado]

I'm working with a github and want to know about some specific actions.

How do I remove:

  1. all files and folders in the current branch with a single command?
  2. all the history in current branch?
  3. a folder "extra/" and a filename "config-empty.txt" in the all folders and subfolders in the current branch?
  4. a history of the specified file or folder?
  5. a folder which has an exclamation mark in the name? Like "!jeremy/"

Gracias por su tiempo.

preguntado el 28 de agosto de 12 a las 10:08

You're probably not going to get answers to all those queries in a single question -- why not split them up into separate questions, which can be more easily answered. -

You remove them like usual and then you commit, that you removed them. Whats the concrete problem you faced? -

It's all about git, why do I have to divide all of them into single small questions? Someone can say "it's too easy question to answer in a separate topic". -

@KingCrunch there're more than 50 files and folders in the root of the branch. You want me to delete all of them one by one? :) -

@Brain, all of estas preguntas are about Git as well. They're broken up so that future visitors can find answers to their specific problems. -

1 Respuestas

You could at least sort your questions, the history ones in a block and the removing ones in another.

So for questions 1,3,5 I would say, from the root of your repo:

rm -rf * luego git add -u * o en su lugar git rm -rf * and then commit, in order to remove everything

or remove what you want, as you do in your preferred OS, then git add -u * (update) and commit

(for 3 and 5 specifically the question depends on your OS/filesystem, not Git, and I believe you can figure an answer on your own)

As for 2 and 4, why would you remove history? If you remove anything, you will not retrieve it (I mean if you migrate code, imagine you want to have an idea of what happened in the past). The only reason I would imagine is you added bad code and you want to go back in the time before you made the mistakes. In this case branch from your point back in the day and work from that point.

If you are determined to remove some history, you can probably go dig in the .git folder at the root of your repo/local copy and remove manually data, but I (and I am probably not the only one) highly not recommend it.

Respondido 28 ago 12, 10:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.