git init
git config --global user.name ”Arifur”
git config --global user.email ”arifur@gmail.com”
git add .
git commit -m "v one"
git log --oneline
git status
git config --global core.autocrlf true
git config --global http.postBuffer 524288000
git push origin master
Git vs. GitHub: What's the difference?
Git a sadaronoto doi babe kaj kora jai
git gui
git terminal
Git gui r git terminal er modde git terminal use kora better.git gui holo graphical user interface
Sobar prothom amara akta working directory use korte hobe .je working directory te আমরা amader project file golo rakbo.ai working directory ta amra git er reposrity hisabe initialliaz korbo.
Lets create a git reposority
Prothom a floder create korte hobe .folder er name dibo anything u want ami akane folder name dilam pc
ai pc name er floder ta k git er reposority hisabe create korte hobe .jar fole ai folder a kono codeing kori change kori .tokon ta git track korte pare.
Git gui diye repository create kora :
Protom e pc folder a jete hobe r right click korle git gui name a option a click kore git gui ta open korbo
Then create new reposority te click korbo
Then browse name er option a giye pc folder ta select korte hobe .then pc folder a .git name file asbe.
Terminal diye repository create kora :
Coffee name akta noton folder korbo
Then coffee folder a gitbash terminal open korbo
Git init
er maddome coffee folder er repository create hoye gelo . akon Jodi ai coffee folder a kono kicho poriborton kori tobe ta git track korbe
Jeheto git a oonek jon mile kaj kora jai seheto git er o kinto idenfication dorkar .er janno akta user name r email git er modde diye dite hobe
Git a user name r email 2 ta way te deya jai akta holo
1.globally
2.locally
Globally kibae user name r email setup:
protekta floder er jonno aki name r email
$ git config --global user.name ”Arifur”
$ git config --global user.email ”arifur@gmail.com”
locally kibae user name r email setup:
protekta floder er jonno alada alada name r email
$git config user.name ”Arifur”
$git config git user.email ”Arifur@gmail.com”
Apner git a kon kon user name r email set kora ace ta kibabe ber korbo:
$ git config –list
Rescan,unstage,stage
Git gui te amra stage unstage kore cilam
Akon ta amra terminal er madomme korbo
$git status
Er mane holo cold and hot name r file ta git track kora soro kore nai
How to stage?
$ git add cold.txt
Er maddome staging kora hoi
Kibabe bojbo staging kora hoyece kina:
$ git status
Ebabe akta akta kore kob ei somoi sapekoo.tar jonno 2ta shortcut code ace ta holo
git add --all
git add .
remember ekane fullstop ace
Attokon ja korlam ta holo working area theke staging area te niye gelam
Steging area the niye jawar por sei change golo k commit korte hobe
$ git commit
$ git commit like enter click korle onno akti terminal a chole jabe
How to commit
$ git commit
$ git commit like enter click korle onno akti terminal a chole jabe
Then I button press korle insert option asbe
Akon commit er je massage ta add korte cacci ta likbo
Erpor keyboard er esc button click korte hobe tarpor press korte hobe :x
Fole 2 ta file chang hoyeche
How to commit(shortcut)
$git commit -m “chocolate added”
$git commit -m "v one"
Git log
Git log er kaj holo ai porjonto apni joto golo comit kore chen ta deka
$ git log
$ git log –oneline
er sobgolo short kore dekabe
File a chane ene exprement
File kicho add kore
Then terminal e $git status run korle dekabe modifier:je file a midify korhi
Tarpor git staging korbo $git add . er maddome
Tarpor git comit korbo
$ git commit -m "ice cube added"
Er maddome
Tarpor amra ki ki kaj koreci ta dekbo
$ git log --oneline
Er maddome
Git checkout
Ami bolbosto ice cube stage a chole gechi ami ager stage chole jete cai.
$git checkout 690f09
$git checkout 85167d5
$git checkout master dile ager kaj e fire jabo
Git diff
Git diff er maddome last er stage ace sei stage theke akon je stage ace tar different tole dore
$git show
Chochalate added a ki ki proriborton hoyeche ta apni $git show er maddome dekte parben
$git rm
Akon remote repository er sate local repository er connect kibabe hoi?
ortat github ba gitlab er sate local repository kibabe connect hobe ba kibabe sync hobe.ortat apner local repository je kaj golo korche ta jeno remote repository te atumaticly chole jai.
Github accout open
Nije nije kore naw
Kibabe amder project github account e reke debo?
Sei jonno github e a reposority create korte hobe.
Eta copy korar por terminal e giye amra command ta past korbo
Er fole local reposiroty the je project ace ta amra remote repository the push kore patiye debo
Ekane github username r password dite hobe
File golo successfully remote repository the chole eseche
Ssh key
Ekane akta problem holo jokon file ta push korben tokon user name r password ta bar bar chibe so eta akta worse
Ei sommosa somadan er jonno amra use korbo ssh key
Lets go….
start from here
Then terminal a
$ ssh-keygen -t rsa -b 4096 -C "_your\_email@example.com_"
Then enter
> Enter a file in which to save the key (/c/Users/you/.ssh/id*rsa):*[Press enter]_
Then
$ eval $(ssh-agent -s)
Ei code run korle apnak a agent code dibe
Agent pid 59566
Then
$ ssh-add ~/.ssh/id_rsa
Code ta like run koron enter press korte hobe
Eake password ta abr dite hobe
Last apnak poro jinis ta copy korte hobe .copy kore apner github a eta add korte hobe
Tahole eta kibabe copy korben
$ clip < ~/.ssh/id_rsa.pub
Eta run korle sate sate eta apner clipboard a copy hoye giyeche
Akon amra amader github e amader key ta add korbo
Add shh key the press korbo
Then create reposory the click korbo
Terminal e past korbo
Then yes diben.yes dile project ta user name email password chara push hoye giye che .
Then refresh dile project ta github a chole asbe
Ssh key process end here
Remote repository theke local repository ba working directory the clone kore kibabe niye aste paren ?
Way1:
But this is not goot way
Way2(git clone):
(git clone) er name change:
Git fetch git pull
ekane ai project ti push pull korle user name r password r chibe na .
ai project dibe amra apnak fetch and pull dekabo so
ai project er remote repository te chole jabo
then amade student.txt file ace tar modde kicho likbo ba poriborton korbo
file er edit option a giye amra student file ta the kicho edit korbo ba poriborton korbo
edit kora por commit option e giye kicho add korbo
ei edit ti Jodi amra local repository the deki ta hole deka jabe student.txt file a kichoi add hoi nai
Ekane $git status diye dekle dekben akne kono kicho leka nai
Erpor ekane $git fetch like enter press korbo then password debo
Er pole local repository bojte parbe ekane a1 commit eseche
But student.txt file one korle deben kono kichp add hoi nai
Tar jooono $git pull like enter press korle r ssh er password ta debo dekben student.txt file a add hoyeche
***remember git fetch holo github er file er je change golo ace ta locol repository the obogoto kora .r git pull holo remote repository ba github te je poribor hoiye ta local repository te niye asa
Git branching:
$git branch idbranch er maddome branch create kora hoi
$git branch er madomme koita brach ace ta jana jai
$git checkout idbrach er maddome ak branch theke onno branch e jawa jai
Branch create kora sate sate brance poriborton kora jai kibabe?
$git checkout -b home-branch
Abar master branch e jawae jonno ki korte hobe?
$git checkout master
Home branch er change golo kibabe master branch e niye jabo?
$git marge home-branch
Kibabe akta branch delete korbo?
$git branch –d idbranch
git stash and clean
Add image/screenshot of your project to your GitHub repository
How can I rename a Git branch?
There may be times when you need to rename a Git branch. This is because if the naming is wrong and other developers continue to work with it, you may run into problems. Fortunately, despite the tight integration and various forks, if you want to rename a Git branch, it’s not a big issue. To do this, use the -m command. The corresponding syntax always follows the same structure:
git branch -m <old-name> <new-name>
However, there are differences between branches that you edit locally and those that are already remote. Below we explain the steps for both cases.
Rename a local Git branch
A local Git branch exists only on your computer. You make changes and tests here without other developers noticing. Renaming it can therefore be done quickly.
- In the command line, select the Git branch you want to rename. The command for this is
git checkout old-name
- You will get a confirmation that you have selected the correct branch. This will read
Switched to branch 'old-name'
- Now perform the actual rename for the local Git branch. The appropriate command for this is:
git branch -m new-name
Alternatively, you have the option to rename the Git branch via the master. To do this, use the following steps:
- Switch to the master via the command
git checkout master
- Now enter the following command if you want to rename a
Git branch: git branch -m old-name new-name
- To ensure that the rename was successful, retrieve the current status of the branch using the
git branch -a
command.
Renaming a remote Git branch
In a remote repository, you cannot simply rename a Git branch, as this would lead to complications. Instead, you need to delete the old name and then add the branch with the new name. Fortunately, this is not too hard either and can be done with a few simple commands. As with the local branch, you have two options.
First, make sure the local branch has the correct, new name. The appropriate command is
git branch -a
Now delete the branch with the old, incorrect name from the remote repository. To do this, use the following command:
git push origin --delete old-name
Verify that the old branch has been deleted properly.
Now add the branch with the correct name. For this, use the command
git push origin -u new-name
Lastly, perform a reset of the upstream branch to ensure that the changes are effective.
However, if you want to rename the remote Git Branch with just one command, you also have the following option.
Enter the following command:
git push origin :old-name new-name
Then also perform a reset of the upstream branch as described above.
Conclusion: Git branch rename
Mistakes happen, and Git is designed to let you rename Git branches easily. It can be done quickly and with a few commands. While the process is a rename in the true sense for local branches, a deletion is necessary in the remote branch. Once the error is fixed, it makes sense to carefully double-check. Afterwards you and other developers can continue working on your project without any restrictions.
Top comments (0)