Last active
June 23, 2025 08:38
-
-
Save luckysitara/0111d1ae9e072c35fd13b31c59d61d06 to your computer and use it in GitHub Desktop.
Revisions
-
luckysitara revised this gist
Jun 23, 2025 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -87,6 +87,11 @@ echo $PATH If not, do the following based on your shell: ## To know your which shell you're using use ```bash echo $SHELL ``` #### If you're using **Bash**: ```bash -
luckysitara revised this gist
Jun 13, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -190,7 +190,7 @@ From any Git project directory: ```bash push "updating README with new section" ``` replace "updating README with new section" with your commit message --- ## π§ Summary of What This Does: -
luckysitara revised this gist
Jun 13, 2025 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,13 @@ --- ## β GIT ADD ., GIT COMMIT, GIT PUSH CHEAT --- ## π§ Option A ### π§± Step 1: Create Your Script 1. Open a terminal. @@ -119,7 +122,7 @@ You should see: --- ## π§ Option B (Recommended): Use a Shell Alias letβs enhance your workflow by: -
luckysitara revised this gist
Jun 13, 2025 . 1 changed file with 80 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -119,10 +119,86 @@ You should see: --- ## π§ Option A (Recommended): Use a Shell Alias letβs enhance your workflow by: 1. β Creating a script that also shows `git status` after push 2. β Creating a global **alias** named `push` so you donβt have to move or chmod anything manually. --- ### π§± Step 1: Create the Bash Function Alias Open your shell config file: * For **Bash**: ```bash nano ~/.bashrc ``` * For **Zsh**: ```bash nano ~/.zshrc ``` ### π§© Step 2: Add This Function Alias Paste this **at the bottom** of the file: ```bash function push() { if [ $# -eq 0 ]; then echo "β Usage: push \"your commit message\"" return 1 fi local commit_message="$*" echo "π Staging changes..." git add . echo "π Committing..." git commit -m "$commit_message" echo "π Pushing to remote..." git push echo "π Status:" git status echo "β Done!" } ``` ### π Step 3: Apply Changes ```bash source ~/.bashrc # or ~/.zshrc ``` --- ### β Step 4: Use It Anywhere From any Git project directory: ```bash push "updating README with new section" ``` --- ## π§ Summary of What This Does: * β Adds all changes: `git add .` * β Commits with your message * β Pushes to the current branch * β Displays `git status` to confirm whatβs left (if anything) --- --- -
luckysitara renamed this gist
Jun 13, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
luckysitara created this gist
Jun 13, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,128 @@ --- ## β GIT ADD ., GIT COMMIT, GIT PUSH CHEAT --- ### π§± Step 1: Create Your Script 1. Open a terminal. 2. Run this to create the script file: ```bash nano push ``` 3. Paste the following content: ```bash #!/bin/bash # Check if a commit message is provided if [ $# -eq 0 ]; then echo "β Usage: push \"your commit message\"" exit 1 fi # Combine all arguments into one commit message commit_message="$*" echo "π Staging changes..." git add . echo "π Committing changes..." git commit -m "$commit_message" echo "π Pushing to remote..." git push echo "β Done!" ``` 4. Save and exit: * Press `CTRL+O`, then `ENTER` to save. * Press `CTRL+X` to exit. --- ### π Step 2: Make the Script Executable Run: ```bash chmod +x push ``` --- ### π Step 3: Create a Local Bin Directory (if it doesnβt exist) ```bash mkdir -p ~/.local/bin ``` --- ### π Step 4: Move the Script to Your Local Bin ```bash mv push ~/.local/bin/ ``` --- ### π οΈ Step 5: Add `~/.local/bin` to Your PATH #### Check if it's already in your PATH: ```bash echo $PATH ``` If not, do the following based on your shell: #### If you're using **Bash**: ```bash echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc ``` #### If you're using **Zsh**: ```bash echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc source ~/.zshrc ``` --- ### β Step 6: Test It! Go to any Git-tracked folder and run: ```bash push "your commit message here" ``` You should see: ``` π Staging changes... π Committing changes... π Pushing to remote... β Done! ``` --- ## π‘ Optional Tips * Add a `git status` or `git log -1` if you want to confirm the commit. * Add error handling for `git` commands if you want more robustness. * You can also create aliases or extend this to handle branches. ---