Veelgebruikte commando's en tips, wordt aangevuld wanneer ik ze tegenkom.
GIT
- code
-
# See what's coming in from the repository: git fetch git log ..origin/master # Ignore filemode changes git config core.fileMode false # Apply what has been fetched: git merge # ...or supply the (local) branche to merge git merge origin/master # See what's going out before you commit git fetch git log origin/master.. # Undo last commit git reset HEAD~
Gewoonlijk is het geen goed plan om de commit-historie weg te halen omdat je GIT juist gebruikt zodat je een historie krijgt, maar soms is het toch nodig.
Deze procedure maakt een nieuwe branch aan en duwt die als nieuwe master terug naar de server. De nieuwe branch heeft niet de historie die de oude heeft en door daarna ook nog een prune te doen raak je de historie kwijt.
git checkout --orphan newBranch
git add -A # Add all files and commit them
git commit
git branch -D master # Deletes the master branch
git branch -m master # Rename the current branch to master
git push -f origin master # Force push master branch to github
git gc --aggressive --prune=all # remove the old files
GitLab by default marks master branch as protected (See part Protecting your code in https://about.gitlab.com/2014/11/26/keeping-your-code-protected/ why). If so in your case, then this can help:
Open your project > Settings > Repository and go to "Protected branches", find "master" branch into the list and click "Unprotect" and try again.