Git all Command
Check Git status
1)git status
Add changes to stage
2)git add .filenames
git add . (stage all files)
git add -a (add all files)
Once we have finished our work, we are ready to move stage to commit for our repo.
3)git commit -m "Message"
Get up-to-date code from the repo
4)git pull
move change file to the server
5)git push
check in which branch
6)git branch
Create new branch
7) git branch branchname
Switch branch
8)git checkout branchname
git configuration
9)git config --list
Create a new branch from a branch
git checkout -b branchname (create clone branch of current branch with given name)
Merge Branches
lets current branch test1
want to merge test2 in test1
10)git merge test2
Delete branch
11)git branch -d branchname
Git check remote
12)git remote -v
Git add remote
13) git remote add origin <remote_repo_url>
Remove Files from stage
14)git rm --cached <file name or files name>
Remove changes from modified files
15)git restore <file name or files name>
See Git Logs
16)git log
17)git log --oneline
18)git reflog
Rollback changes after commit
19)git reset --hard <commitid> (will remove all changes after this commit id)
Send some specific files to master branch from feature branch
20) git checkout feature new2.txt new4.txt
note:- all steps
#first you are in master branch
#create feature branch from master
git checkout -b feature
#create new files in feature
touch file1 file2 file3 file4
git add.
git commit -m "some new features added"
Comments
Post a Comment