some useful hints for git incase brain dead

If you intended to start a new repository in this directory, you can initialize it with:
git init
If you meant to work with an existing repository, you might need to clone it from GitHub or another source. You can do this with:
git clone <repository-url>
git clone can potentially override local files if you try to clone a repository into a directory that already contains files.
Empty Directory: If you clone a repository into an empty directory, it will copy all the files and commit history from the remote repository into that directory without issues.
Non-Empty Directory: If you attempt to clone a repository into a directory that already has files, Git will not allow it and will display an error message:
1. Clone into a New Directory: Specify a new directory name when cloning:
git clone <repository-url> new-directory-name
2. Move Existing Files: If you want to clone into a specific directory that already contains files, you can:
Move the existing files to another location.
Clone the repository into that directory.
mv existing-file.txt /path/to/backup/
git clone <repository-url> existing-directory
3. Pull Changes Instead: If you already have a local repository and want to update it with changes from the remote repository, use:
git pull
Ensure your local repository is linked to the correct GitHub repository. You can check this with:
git remote -v
This will list the remote repositories associated with your local repo.
git add .
stage selected files:
git add [filename1] [filename2]
Commit the staged changes with a descriptive message:
git commit -m "Your commit message here"
means that you have made a commit in your local repository that hasn't been pushed to the remote repository on GitHub
unsure whether other changes have been made on the remote since your last pull, you might want to fetch updates first:
git fetch origin
To remove the last commit but keep the changes in your working directory:
git reset
If you want to discard the last commit and its changes entirely:
git reset --hard [HEAD~1]
Then create a new commit
git push origin main --force
The --force option is necessary here because you have rewritten history by removing the previous commit. Be cautious when using --force, especially if others are also working on the same branch.
# Reset the last commit but keep changes
git reset HEAD~1
# Make your changes to the files
# Stage the changes
git add .
# Commit the changes with a new message
git commit -m "Your new commit message here"
# Push the changes to the remote repository
git push origin main --force
Push your committed changes to the specific GitHub repository. If you want to push to the main branch (or any other branch), use:
git push origin main
Replace main with the name of the branch you're working on if it's different.
If you want to commit to a branch other than main, ensure you're on that branch by using:
git checkout [branch-name]
Create a New Branch (Optional): If you want to work on a new branch before pushing:
git checkout -b [new-branch-name]
Example:
cd path/to/your/local/repo
git remote -v # Check remote repository
git add . # Stage all changes
git commit -m "Add new feature" # Commit changes
git push origin main # Push to the main branch on GitHub
Stash Your Changes: If you have uncommitted changes, run:
git stash
This saves your changes temporarily and gives you a clean working directory.
Pull the Latest Changes: Next, get the latest code from the branch:
git pull
Apply Your Stashed Changes: After pulling, you can bring back your stashed changes:
git stash pop
Resolve Conflicts (if any): If there are conflicts, resolve them as needed.
Commit Your Changes: Once everything is in order, commit your changes:
git add .
git commit -m "Your commit message"
Push to the Branch: Finally, push your changes to the remote repository:
git push
This workflow helps you avoid conflicts and ensures you’re working with the latest code.
Create a Pull Request (PR)
Open a Pull Request: Navigate to your repository on the platform you're using (like GitHub, GitLab, or Bitbucket).
Select Your Branch: Choose the branch where you made your changes and select the target branch (usually main or develop).
Fill Out the PR Template: Include a clear description of what the changes do, any relevant issues they address, and other context that might be useful for the reviewer.
### Summary
This PR implements the new feature for user authentication.
### Changes Made
- Added login and signup forms
- Implemented validation for user input
- Updated backend API endpoints for user management
### Related Issues
- Fixes #123
- Implements #456
@leader-username Please review this when you can!