Bladeren bron

Added chapter about deep removing.

Kristian Schultz 4 jaren geleden
bovenliggende
commit
24305a6fd7
1 gewijzigde bestanden met toevoegingen van 38 en 0 verwijderingen
  1. 38 0
      src/faq/addThingsToProject.tex

+ 38 - 0
src/faq/addThingsToProject.tex

@@ -222,3 +222,41 @@
 \codeline{git push}
 
 
+\subsection{\de{Eine Datei aus der History entfernen}\en{Removing a file out of the history}}
+
+\begin{DE}
+\end{DE}
+\begin{EN}
+\end{EN}
+
+
+\begin{itemize}
+\item \de{Es dürfen keine offenen Merge requests sein.}\en{Be sure that there is no open merge request.}
+
+\item \codeline{git filter-branch --force $\backslash$ \\
+ \mbox{}\hspace{1cm}--index-filter \"{}git rm --cached --ignore-unmatch \placeholder{FILE\_NAME}\"{} $\backslash$ \\
+ \mbox{}\hspace{1cm}--prune-empty --tag-name-filter cat -- --all}
+
+\item Add the file to your \var{.gitignore} file.
+    \codeline{echo \"{}\placeholder{FILE\_NAME}\"{} $>>$ .gitignore}
+
+    \codeline{git commit -m \"{}Add \placeholder{FILE\_NAME} to .gitignore\"{}}
+
+\item \codeline{git push origin --force --all}
+
+\item Tell your collaborators to rebase, not merge, any branches they created off of your old (tainted) repository history. One merge commit could reintroduce some or all of the tainted history that you just went to the trouble of purging.
+
+    $\rightarrow$ \url{https://git-scm.com/book/en/Git-Branching-Rebasing}
+
+
+% \item After some time has passed and you're confident that git filter-branch had no unintended side effects, you can force all objects in your local repository to be dereferenced and garbage collected with the following commands (using Git 1.8.5 or newer):
+% 
+%     \codeline{git for-each-ref --format=\"{}delete \%{}(refname)\"{} refs/original $|$ git update-ref --stdin}
+%     \codeline{git reflog expire --expire=now --all}
+%     \codeline{git gc --prune=now}
+\end{itemize}
+
+
+
+$\rightarrow$ \url{https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository}
+