Skip to content

Latest commit

 

History

History
97 lines (75 loc) · 2.75 KB

gitCommands.md

File metadata and controls

97 lines (75 loc) · 2.75 KB

#GIT COMMANDS:

Reset local repository branch to master:

  • git fetch origin
  • git reset --hard origin/master
  • git checkout master

Init Repo:

  • init: git init
  • add all: git add -A
  • commit all: git commit -am „commit message“
  • rename last commit: git commit --amend

Reset Git:

  • rm -rf .git
  • git init

Stash / Patch diff and apply the Patch

  • create diff: git diff origin/branchname > changes.patch
  • ggf reset branch: git reset --hard origin/branchname
  • apply diff: git apply changes.patch

Ticket bearbeiten:

  • switch to branch: git checkout „feature_branch“
  • create and switch to branch: git checkout -b „feature_branch“
  • show remote branches: git branch -r
  • To delete a local branch: git branch -d feature_branch
  • To delete a remote branch: git push origin :feature_branch
  • To show remote branches: git remote show origin

Ticket auf Master rebase:

  • git checkout „master“
  • git pull
  • git checkout „feature_branch“
  • git rebase master
  • git checkout master
  • git merge - - ff-only feature_branch

Tags:

LÖSCHEN:

  • git tag -d 12345
  • git push origin :12345

NEU ANLEGEN

  • git tag 12345
  • To push a single tag:
  • git push origin <tag_name>
  • And the following command should push all tags (not recommended):
  • git push --tags

Wenn man zu alten kommt zurück will:

to update remote branches (clean up the deleted ones):

  • git remote update origin --prune

to find all branches that belong to me, use the script:

find-my-branches.sh mniemczyk

to delete all branches beside master and current

git branch | grep -v "master" | grep -v ^* | xargs git branch -D

to revert a commit:

  • git revert e793a613a06aeacac2d784616b849bca0b8f9a95 (if last thats the most upper commit)

mvn version

  • mvn versions:set -DnewVersion=1.1.22

GIT HUB

  1. Fork their repo on Github
  2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it

I. echo "# notes" >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/Macilias/notes.git git push -u origin master

II. git remote add origin https://github.com/Macilias/notes.git git push -u origin master