Git Daily use Commands

Git Daily use Commands

Clone your git repo

git clone https://github.com/ngdeveloper-projects/SpringBoot-Kakfa

https://github.com/ngdeveloper-projects/SpringBoot-Kakfa is same github repo url. Also note this command check outs the default master (mostly) or default configured branch will be checked out.

Fetch all

git fetch --all

Always fetch first to make sure all the remote branches, tags everything is properly fetched to your loal then you can easily switch/checkout to new branches created recently.

Checkout the branch first time

git checkout -b ngdeveloper_fsdev

ngdeveloper_fsdev is the branch name. This also creates the ngdeveloper_fsdev local branch in local repo.

Checkout the branch (Switching the branch)

git checkout ngdeveloper_fsdev

ngdeveloper_fsdev is the branch name.

Take the latest code from the same branch

git pull

Take the pull from ngdeveloper_fsdev remote origin branch to your local branch which is ngdeveloper_fsdev in our case.

Take the latest code from another branch

git pull origin ngdev_fsdev_main

Take the pull from ngdev_fsdev_main remote origin branch to your local branch which is ngdeveloper_fsdev in our case.

Commit your code

git commit -m "dependency upgraded"

dependency upgraded is your commit message. Always give the meaningful name should also means the actual change you are committing. Some companies follows JIRA ID followed by message (eg: NGDEV-1033: dependency upgraded – if so pls follow the same else it creates some other issues)

Push your code to remote

git push

This pushes your committed changes to your connected remote repo. if you are not sure about your remote repo, check using this command.

Merge the changes from another branch (mostly main feature branch or master)

git merge --no-ff ngdev_fsdev_feature_main

Git Bonus Commands

Check recent commit log

git log --oneline

Show remote origin details

git remote show origin

This shows the repo url of the currently configured as remote origin, meaning all your changes will be pushed or reflected to this remote repo only.

Check the current branch

git branch --show-current

List branches

git branch -a // list all the branches
git branch -l // list all local branches
git branch -r // list all remote branches

Reset your branch

git reset // mixed reset (staged to unstaged)
git reset --hard // this resets to the head of the origin

12 comments

  • Dora3965

    The Beatles – легендарная британская рок-группа, сформированная в 1960 году в Ливерпуле. Их музыка стала символом эпохи и оказала огромное влияние на мировую культуру. Среди их лучших песен: “Hey Jude”, “Let It Be”, “Yesterday”, “Come Together”, “Here Comes the Sun”, “A Day in the Life”, “Something”, “Eleanor Rigby” и многие другие. Их творчество отличается мелодичностью, глубиной текстов и экспериментами в звуке, что сделало их одной из самых влиятельных групп в истории музыки. Музыка 2024 года слушать онлайн и скачать бесплатно mp3.

  • This stage is incredible. The magnificent information uncovers the manager’s excitement. I’m shocked and anticipate additional such mind blowing substance.

  • Nice blog here Also your site loads up fast What host are you using Can I get your affiliate link to your host I wish my web site loaded up as quickly as yours lol

  • My brother recommended I might like this web site He was totally right This post actually made my day You cannt imagine just how much time I had spent for this information Thanks

  • Your writing has a way of resonating with me on a deep level. I appreciate the honesty and authenticity you bring to every post. Thank you for sharing your journey with us.

  • Ive read several just right stuff here Certainly price bookmarking for revisiting I wonder how a lot effort you place to create this kind of great informative website

  • I have read some excellent stuff here Definitely value bookmarking for revisiting I wonder how much effort you put to make the sort of excellent informative website

  • O que eu não entendo é na verdade como você não é realmente muito mais querido do que é agora Você é muito inteligente Você sabe, portanto, significativamente no caso deste tópico que me produziu individualmente, imagine-o de vários ângulos diferentes É como homens e mulheres não pareça fascinado até que seja algo a ver com Mulher gaga Suas próprias coisas são legais Todo o tempo cuide disso

  • Gia Lai Tech On my leap13 com – Khám phá những liên kết hữu ích đưa bạn đến trang chủ của Gia Lai Tech – Blog Công Nghệ Hàng Đầu Gia Lai

  • app nhìn xuyên thấu – tham khảo ngay! tải ngay ứng dụng để xem những gì mình thích ngay nhé

  • app xem đá bóng dành cho những ai đam mê bóng đá, hãy truy cập ngay và thưởng thức những trận cầu siêu kinh điển ngay.

  • quay thử miền bắc là địa chỉ quay thử xổ số miền Bắc có xác suất cao nhất hiện nay. Những con số may mắn đang chờ bạn, hãy thử vận may ngat cùng quaythumienbac.com #quaythumienbac #quaythuxosomienbac #quaythumienbaccom

Leave a Reply