newdevs:git:commands
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
newdevs:git:commands [2023/12/01 10:09] – tmccanna | newdevs:git:commands [2024/08/29 13:34] (current) – sleary | ||
---|---|---|---|
Line 23: | Line 23: | ||
* '' | * '' | ||
* '' | * '' | ||
+ | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
Line 34: | Line 35: | ||
* '' | * '' | ||
* '' | * '' | ||
- | * '' | + | |
+ | * '' | ||
+ | | ||
* '' | * '' | ||
* '' | * '' | ||
Line 56: | Line 59: | ||
* '' | * '' | ||
- | ==== Rebase ==== | + | ===== Rebase |
If your patch is behind current main, you'll need to rebase it. | If your patch is behind current main, you'll need to rebase it. | ||
Line 69: | Line 72: | ||
- Type: git rebase < | - Type: git rebase < | ||
+ | You can also use the interactive rebase mode to look at a series of commits: | ||
+ | |||
+ | - Open the git branch | ||
+ | - Type: '' | ||
+ | - (Optional but recommended) Save this pick list to a separate file, for recovery later if things go wrong | ||
+ | - Choose what to do with each line using the commands listed in the comment block (pick, edit, drop, fixup, squash) | ||
+ | - Save and close the "to do" file | ||
+ | - Follow the prompts to complete each step you specified | ||
- | ==== Squash Commits ==== | + | If you need to start over, just rebase again and paste in your original pick list. |
- | If you are in your local working branch and you've pushed up two commits to the remote git repository, you can combine them: | + | ===== Squash Commits ===== |
- | - Verify that you are in your local branch. | + | If you have multiple commits |
- | - Type: '' | + | |
- | * Alternatively if your branch is already built on current main, you can use: '' | + | - Use ' |
+ | - Type '' | ||
- Your text editor will open and should show both of the commits, for example: | - Your text editor will open and should show both of the commits, for example: | ||
* pick 014e59c579 LP#1839359 Select element on login not accessible | * pick 014e59c579 LP#1839359 Select element on login not accessible | ||
* pick 9de92lsi9a LP#1839359 Select element on login not accessible | * pick 9de92lsi9a LP#1839359 Select element on login not accessible | ||
- | - Change the word " | + | - Change the word " |
* squash --> merges commits, then allows amendment of commit message | * squash --> merges commits, then allows amendment of commit message | ||
* fixup --> merges commits like squash does, but discards previous commit message | * fixup --> merges commits like squash does, but discards previous commit message | ||
- | - Push the commit | + | - Use " |
- | * '' | + | - Push the changes up to your remote working directory as normal |
- | + | * '' | |
- | + | ||
- | ==== Common Bash Commands ==== | + | |
- | + | ||
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ==== Vim Text Editor ==== | + | |
- | + | ||
- | The vim text editor is built into the bash console (similar to notepad in Windows). | + | |
- | * '' | + | If you've already pushed multiple commits up to your remote working git repository, you can still combine them: |
- | * '' | + | |
- | Vim opens in command mode, which allows a variety of functions, but does not allow direct editing. | + | - Follow the steps above, but when pushing, use "--force" |
- | * '' | + | * '' |
- | * '' | + | |
- | * '': | + | |
- | * '': | + | |
- | * '': | + | |
- | * '': | + | |
- | * ''? | + | |
+ | ===== Aliases ===== | ||
+ | Shortens normal commands so you type less: | ||
+ | < | ||
+ | $ git config alias.co checkout | ||
+ | $ git config alias.cp cherry-pick | ||
+ | $ git config alias.br branch | ||
+ | $ git config alias.ci commit | ||
+ | $ git config alias.st status | ||
+ | </ | ||
newdevs/git/commands.1701443344.txt.gz · Last modified: 2023/12/01 10:09 by tmccanna