Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bash scripts for frequently used Git commands

Git Clone

Setup

  1. Edit branch names (line 3, 4) don't edit variable names unless you change all occurances.
  2. Edit GitHub username (GitHub ssh must already be enabled on your machine)
  3. Run ./gitClone.sh and follow the prompt

Usage Examples

Clone from URL
./gitClone.sh
Q: Use full git URL?
(y/n): y
Enter the full git URL
<https://github.com/user/repo.git>
Select the branch to use
1) dev_branch
2) main_branch
3) custom
4) quit
Selected <selected branch> branch
Cloning into repo <https://github.com/user/repo.git>
Changing directory => <repo>
Creating branch <selected branch>
Finished cloning into repo <user/repo> and selecting branch <selected branch>
Installing dependencies...
Navigate to new repo by running cd ./<repo>
Clone from repo with non default GitHub username
./gitClone.sh
Q: Use full git URL?
(y/n): <n>
Use default GitHub username? (<default username>)
(y/n): <n>
Enter username: 
<username>
Using username: <custom username>
GitHub repo name: 
<repo>
Select branch to clone into.
1) dev_branch
2) main_branch
3) custom
4) quit
<branch number>
Selected <selected branch> branch
Cloning into repo <user/repo>
Changing directory => <repo>
Creating branch <selected branch>
Finished cloning into repo <user/repo> and selecting branch <selected branch>
Installing dependencies...
Navigate to new repo by running cd ./<repo>
Clone from repo name
./gitClone.sh
Q: Use full git URL?
(y/n): n
Use default GitHub username? (<default username>)
(y/n): y
Using username: <default username>
GitHub repo name: 
<repo>
Select branch to clone into.
1) dev_branch
2) main_branch
3) custom
4) quit
<branch number>
Selected <selected branch> branch
Cloning into repo <user/repo>
Changing directory => <repo>
Creating branch <selected branch>
Finished cloning into repo <user/repo> and selecting branch <selected branch>
Installing dependencies...
Navigate to new repo by running cd ./<repo>
Clone from repo name, with custom branch name
./gitClone.sh
Q: Use full git URL?
(y/n): n
Use default GitHub username? (<default username>)
(y/n): y
Using username: <default username>
GitHub repo name: 
<repo>
Select branch to clone into.
1) dev_branch
2) main_branch
3) custom
4) quit
<3>
Enter branch name:
<custom branch name>
Selected <selected branch> branch
Cloning into repo <user/repo>
Changing directory => <repo>
Creating branch <selected branch>
Finished cloning into repo <user/repo> and selecting branch <selected branch>
Installing dependencies...
Navigate to new repo by running cd ./<repo>

Git Push

Setup

  1. Run ./gitAdd.sh and follow the prompt

Usage Examples

Stage all files for commit
./gitAdd.sh
Stage files in git.
Which files would you like to stage?
1) all
2) allWithChanges
3) custom
4) quit
<1>
Adding all files in current directory to git via git add .
Commit description:
<commit description>
All files in current directory staged for commit.
Commit description: <commit description>
Stage all changed files for commit
./gitAdd.sh
Stage files in git.
Which files would you like to stage?
1) all
2) allWithChanges
3) custom
4) quit
<2>
Adding all changed files in current directory to git via git add -a
Commit description:
<commit description>
ll files with changes in current repository staged for commit.
Commit description: <commit description>
Stage custom files for commit
./gitAdd.sh
Stage files in git.
Which files would you like to stage?
1) all
2) allWithChanges
3) custom
4) quit
<3>
Which files/directories do you want to stage for commit? Ex: ./src ./utils/app.ts
<paths to file(s) or directory>
Commit description:
<commit description>
Files and/or directories staged for commit.
Commit description: <commit description>
Files/directroies selected: <paths to file(s) or directory>

About

Bash scripts for frequently used Git commands

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages