newdevs:git:commands
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
newdevs:git:commands [2020/10/07 17:08] – [Common Bash Commands] tmccanna | newdevs:git:commands [2024/03/25 16:32] – [Squash Commits] tmccanna | ||
---|---|---|---|
Line 1: | Line 1: | ||
**New Developers Working Group** | **New Developers Working Group** | ||
- | ====== Git for Windows ====== | + | ====== |
- | + | ||
- | ===== Useful | + | |
- | + | ||
- | ==== Git Commands | + | |
* '' | * '' | ||
Line 14: | Line 10: | ||
* '' | * '' | ||
* '' | * '' | ||
- | * '' | + | * '' |
- | * '' | + | * '' |
+ | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
+ | * '' | ||
+ | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
+ | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
Line 29: | Line 29: | ||
* '' | * '' | ||
* '' | * '' | ||
- | * '' | + | |
- | * '' | + | * '' |
+ | | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
* '' | * '' | ||
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
* '' | * '' | ||
* '' | * '' | ||
+ | * '' | ||
* '' | * '' | ||
+ | * '' | ||
+ | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
* | * | ||
- | * '' | + | * '' |
+ | * '' | ||
* '' | * '' | ||
+ | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
+ | * '' | ||
+ | |||
+ | ==== Rebase ==== | ||
+ | |||
+ | If your patch is behind current main, you'll need to rebase it. | ||
+ | |||
+ | - Open the git branch | ||
+ | - Type: git rebase origin/main --> rebases the current branch to main (you can do this when you have your branch checked out and changes committed, but have not yet pushed it) | ||
+ | - If there are merge conflict errors, type: git status | ||
+ | - Open the file with the problem in your preferred text editor (notepad++, vim, nano, etc.) | ||
+ | - Look for merge conflict markers in the file (>>> | ||
+ | - Type: git add (problem file name) | ||
+ | - Repeat steps 4-6 for each additional problem file | ||
+ | - Type: git rebase < | ||
+ | |||
==== Squash Commits ==== | ==== Squash Commits ==== | ||
- | If you are in your local working | + | If you have multiple commits |
- | - Verify | + | - Use 'git log' to verify |
- | - Type: git rebase -i origin/ | + | - 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 " |
- | - Push the commit | + | * squash |
- | * git push --force working | + | * fixup --> merges commits like squash does, but discards previous commit message |
+ | - Use "git commit --amend" | ||
+ | - Push the changes up to your remote working directory as normal | ||
+ | * '' | ||
+ | |||
+ | If you've already pushed multiple | ||
+ | |||
+ | - Follow the steps above, but when pushing, use " | ||
+ | * '' | ||
Line 96: | Line 128: | ||
* '': | * '': | ||
* '': | * '': | ||
+ | * '': | ||
+ | * ''? | ||
newdevs/git/commands.txt · Last modified: 2024/08/29 13:34 by sleary