git commands
…or create a new repository on the command line
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/metinkaya1511/FinraDeck.git
(GitHub’daki adres)
git push -u origin master
…push an existing repository from the command line
git remote add origin https://github.com/metinkaya1511/FinraDeck.git
(github adresi)
git push -u origin master
CREATE BRANCH
- git branch develop ==> it creates new branch named 'develop' but still
keep being on master branch
- git checkout develop ==> it will change your branch to the develop branch
git checkout -b develop ==> it creates also a branch named develop and
switches to it automatically
DELETE
git branch -d <branch_name> deletes the branch. If we have unmerged changes,
this command gives a warning and does not delete.
git branch -D <branch_name> deletes the branch even if it has unmerged changes.
Gives no warning.
SWITCH to Branch
git checkout develop checks out the branch, switches to the branch.
git checkout -b <branch_name> creates a new branch and switches to it.
git merge <branch_name> this command takes changes from the given branch,
and merges with the current branches we are on.
3.75
4
Configure Git
$ git config --global user.name "your_username"
$ git config --global user.email "[email protected]"
$ git config --global --list
$ git clone [email protected]:gitlab-tests/sample-project.git
To view the files, go to the new local directory
$ cd sample-project
Clone with HTTPS
$ git clone https://gitlab.com/gitlab-tests/sample-project.git
$ cd sample-project
$ git init
$ git remote add origin [email protected]:username/projectpath.git
Download the latest changes in the project
$ git pull <REMOTE> <name-of-branch>
# For stage single file
$ git add <file-name OR folder-name>
or
# For stage all file
$ git add .
#Confirm that the files have been added to staging:
$ git status
# Adds the file to your local repository and stages it for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
$ git commit -m "Add existing file"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
$ git push origin your-branch
# Pushes the changes in your local repository up to the remote repository you specified as the origin
Thank you!
4
0
3
2
If you want to upload your code first check status
//to check how many files contains changes
1. git status
//to add file to the repository
2. git add youFilePath
//if you want to add all file then
3. git add .
//now commit the code
4. git commit -m "anyMessageYouWantToWrite"
//push the code
5. git push
//if you want code from git then
6. git pull
Thank you!
2
0
0
0
//initialize git
git init
//Connect with git live code
git remote add origin *Enter URL Here*
//Pull from origin main
git pull origin main
//Pull from origin master
git pull origin master
//To check status of changes
git status
//add all
git add .
//add fileA.css fileB.js
git add fileA.css fileB.js
//Commit changes
git commit -m "your commit on changes"
//Push to master
git push -u origin master
Thank you!
0
0
4
1
git init
git add *Enter File Name Here*
git commit -m "first commit"
git remote add origin *Enter URL Here*
git push -u origin master
Thank you!
1
0
4
8
…or create a new repository on the command line
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/metinkaya1511/FinraDeck.git
(GitHub’daki adres)
git push -u origin master
…push an existing repository from the command line
git remote add origin https://github.com/metinkaya1511/FinraDeck.git
(github adresi)
git push -u origin master
CREATE BRANCH
- git branch develop ==> it creates new branch named 'develop' but still
keep being on master branch
- git checkout develop ==> it will change your branch to the develop branch
git checkout -b develop ==> it creates also a branch named develop and
switches to it automatically
DELETE
git branch -d <branch_name> deletes the branch. If we have unmerged changes,
this command gives a warning and does not delete.
git branch -D <branch_name> deletes the branch even if it has unmerged changes.
Gives no warning.
SWITCH to Branch
git checkout develop checks out the branch, switches to the branch.
git checkout -b <branch_name> creates a new branch and switches to it.
git merge <branch_name> this command takes changes from the given branch,
and merges with the current branches we are on.
Thank you!
8
0
4
4
# Create a Repository
git init
# Add Files
git add . # All files
git add <filename>
# Commit the Changes
git commit -m "Message goes here..."
# Remote Repository
git remote add origin <link from github>
# Final Step
git push -u origin master
Thank you!
4
0
4.43
7
// displays the staging area
git status
// create a new repository
git init
// add stages
git add --a or
git add .
// commit
git commit -m "your message"
// know your commit
git log
// skipping staging area Note: Untrack file will not skip
git command -a -m "your message"
// Config user name and email
git config --global user.name "UserName"
git config --global user.email "emailId"
// check user name and email
git config user.name
git config user.email
Thank you!
7
0
0
0
git init
//add all
git add .
//cancel adds
git reset
//cancel commits
git reset HEAD^
//cancel last 3 commits
git reset HEAD~3
//when first commit
git push -u origin master
//remove remote origin
git remote remove origin
//reset remote origin
git remote add origin https://github.com/yourname/project.git
Thank you!
0
0
0
0
/******* Git global setup ********/
git config --global user.name "Abdur Rahman Rakib "
git config --global user.email "[email protected]"
/******* Create a new repository ********/
git clone https://gitlab.com/r_rakib18/blog_laravel.git
cd blog_laravel
git switch -c main
touch README.md
git add README.md
git commit -m "add README"
git push -u origin main
/******* Push an existing folder ********/
cd existing_folder
git init --initial-branch=main
git remote add origin https://gitlab.com/r_rakib18/blog_laravel.git
git add .
git commit -m "Initial commit"
git push -u origin main
/******* Push an existing Git repository ********/
cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab.com/r_rakib18/blog_laravel.git
git push -u origin --all
git push -u origin --tags
Thank you!
0
0
Are there any code examples left?
New code examples in category Other
-
Other 2023-03-27 22:50:10 how to select the whole line in vscode with keyboard shortcut
-
Other 2022-03-27 22:45:24 income of a web developer
-
Other 2022-03-27 22:35:01 \pyrcc_main.py: File does not exist 'resources.qrc'
-
Other 2022-03-27 22:30:45 rick roll embed code
-
Other 2022-03-27 22:20:08 Circuit_04_Potentiometer
-
Other 2022-03-27 22:20:05 iterative power
-
Other 2022-03-27 22:15:11 flutter run all
-
Other 2022-03-27 22:10:05 when is karlson release
-
Other 2022-03-27 22:10:02 wp .htaccess example
-
Other 2022-03-27 22:00:08 bash pause in file read line by line