Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:git [2026/03/17 13:20] – [Commands] tmadelinux:git [2026/07/16 13:09] (current) – [Commands] tmade
Line 17: Line 17:
   git add .                                                #or "git add kubeadm-config.yaml"   git add .                                                #or "git add kubeadm-config.yaml"
   git commit -m "initial commit"                           #to the previously created project on e. g. gitlab   git commit -m "initial commit"                           #to the previously created project on e. g. gitlab
 +  git commit -am "my message"                              #add + commit at once, but just for already staged files in repo. New files have to be added first via "git add file" or "git add ."
   git push gitlab master                                   #update changes to master   git push gitlab master                                   #update changes to master
   git pull origin master                                   #pull changes from master   git pull origin master                                   #pull changes from master
Line 24: Line 25:
   git add file                                             #Add file "file"   git add file                                             #Add file "file"
   git rm --cached myfile                                   #remove file which was previously added   git rm --cached myfile                                   #remove file which was previously added
-  git add .                                                #Add all files in working directory 
-  git commit -m "initial commit"                           #Commit all files with comment 
   git log                                                  #Show history   git log                                                  #Show history
   git revert ID                                            #Revert to change from ID - other changes after not affected   git revert ID                                            #Revert to change from ID - other changes after not affected
Line 33: Line 32:
   git reset --hard HEAD~2                                  #remove 2 commits   git reset --hard HEAD~2                                  #remove 2 commits
   git checkout -b branch-name                              #creates "local" branch, which will be uploaded by "git pull"   git checkout -b branch-name                              #creates "local" branch, which will be uploaded by "git pull"
 +  git push origin --delete <branch-name>                   #delete remote branch
 +  git branch -d <branch-name>                              #delete lokal branch
   tag = read only branch nie wieder veränderbar/ version   tag = read only branch nie wieder veränderbar/ version
   git tag --list   git tag --list
   git branch --list                                        #show local branches   git branch --list                                        #show local branches
   git branch --all                                         #show all branches and remote   git branch --all                                         #show all branches and remote
 +  git branch -D branch                                     #Note: -D is a shortcut for --delete --force. First switch to another branch!
   git fetch --prune                                        #update remote branches and also delete branches not existing on repository anymore   git fetch --prune                                        #update remote branches and also delete branches not existing on repository anymore
   git fetch                                                #update remote branches   git fetch                                                #update remote branches
Line 51: Line 53:
      
  
 +Rebase:
 +
 +  git commit                                                            #if there was a change
 +  git rebase -i HEAD~4                                                  #4 commmits backwards
 +  git rebase -i ffa3fb36cf62ea41824b781b681c7e753d2406ee~ (commit ID)   #back inclusive last commit through "~" at the ende of commit-ID
 +  git rebase -i ffa3fb36cf62ea41824b781b681c7e753d2406ee (commit ID)    #back exclusive last commit 
 +  git push -f
 ====scripts==== ====scripts====
  
linux/git.1773750043.txt.gz · Last modified: by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki