DEV Community

Rıdvan Tülemen for Açıklab

Posted on

3 2

Git ve Github Nedir, Nasıl Kullanılır - Örnekler

Fork Örnek

Github üzerinden Fork butonuna basarak repoyu forkluyoruz. Daha sonrasında bu reponun kendi hesabımızda bir forkunun oluştuğunu görebiliriz.

https://github.com/<YourName/<Repository>
Enter fullscreen mode Exit fullscreen mode

Uygulama

Öncelikle forkladığımız repoyu cloneluyoruz

git clone https://github.com/<YourName/<Repository>
Enter fullscreen mode Exit fullscreen mode

Daha sonrasında istediğimiz değişiklikleri yerel repomuzda yaparak, aşağıdaki adımlar ile kendi uzak forkumuza pushluyoruz

git checkout -b <BranchName>
git add .
git commit -m "commit mesajı"
git push -u origin <BranchName>
Enter fullscreen mode Exit fullscreen mode

Bu adımdan sonra Github üzerinden Compare & pull request butonuna basarak Pull Request oluşturuyoruz.

image

Aşağıdaki ekran görüntüsünde de gözüktüğü gibi, asıl repodaki mergelemek istediğimiz branchi seçiyoruz, istersek Leave a comment kısmına yaptığımız değişiklikler hakkında detaylı bilgi veriyoruz ve Create pull request butonuna basıyoruz
image

İşlemleri doğru bir şekilde yaptıysanız, aşağıdaki gibi bir ekran göreceksiniz
image

Stash Örnek

Eğer yerel reponuzda bir değişiklik yaptıktan sonra ve commitlemeden önce, asıl repoda, sizin son pullunuzdan sonra değişiklik yapılmış ise, değişiklikleri kaydetmeden asıl repoyu pulllamak isterseniz aşağıdaki gibi bir hata alırsınız

Please commit your changes or stash them before you merge.
Enter fullscreen mode Exit fullscreen mode

Bunun çözümü olarak da aşağıdaki yol izlenir

git stash
git pull upstream <BranchName>
git stash pop
Enter fullscreen mode Exit fullscreen mode

Bu komutlar sırasıyla, önce yaptığınız değişiklikleri stashe atar. Daha sonrasında asıl repodaki değişiklikleri yerel reponuza çeker. Son olarak da, öncesinde stashlediğimiz değişiklikleri poplayarak, değişiklikleri kaybetmemizi engellemiş olur.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay